Envek / aws-sam-typescript-layers-example

Example project for developing AWS Lambda functions on TypeScript with all goodies: local development, tests, debugging, shared layers (3rd party and your own), and deploy.

Home Page:https://evilmartians.com/chronicles/serverless-typescript-a-complete-setup-for-aws-sam-lambda

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error 'Refusing to install package with name "delete-test-01" under a package'

bnegrao opened this issue · comments

Hi Envek, first of all thank you for this amazing project. I think it is still relevant because the implementation of AWS 'sam build' with esbuild results in a huge ".js" file with all the dependencies embedded in it, that's why I searched for your project.

I cloned your repository, then I ran "npm install", then "sam.cmd build" (i am on windows 10). Then I received the error bellow:

$ sam.cmd build
Your template contains a resource with logical ID "ServerlessRestApi", which is a reserved logical ID in AWS SAM. It could result in unexpected behaviors and is not recommended.
Building layer 'RuntimeDependenciesLayer'
Running CustomMakeBuilder:CopySource
Running CustomMakeBuilder:MakeBuild
Current Artifacts Directory : C:/Users/bnegrao/perch/aws-sam-typescript-layers-example/.aws-sam/build/RuntimeDependenciesLayer
mkdir -p "C:/Users/bnegrao/perch/aws-sam-typescript-layers-example/.aws-sam/build/RuntimeDependenciesLayer/nodejs"
cp package.json package-lock.json "C:/Users/bnegrao/perch/aws-sam-typescript-layers-example/.aws-sam/build/RuntimeDependenciesLayer/nodejs/"
npm install --production --prefix "C:/Users/bnegrao/perch/aws-sam-typescript-layers-example/.aws-sam/build/RuntimeDependenciesLayer/nodejs/"

Build Failed
Error: CustomMakeBuilder:MakeBuild - Make Failed: npm ERR! code ENOSELF
npm ERR! Refusing to install package with name "delete-test-01" under a package
npm ERR! also called "delete-test-01". Did you name your project the same
npm ERR! as the dependency you're installing?
npm ERR!
npm ERR! For more information, see:
npm ERR!     <https://docs.npmjs.com/cli/install#limitations-of-npms-install-algorithm>

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\bnegrao\AppData\Roaming\npm-cache\_logs\2022-08-25T03_37_54_922Z-debug.log
make: *** [C:\Users\bnegrao\perch\aws-sam-typescript-layers-example\Makefile:23: build-RuntimeDependenciesLayer] Error 1

I am new to typescript and javascript, so I am sorry if that's a silly issue.

Regards,
bruno

Show your package.json, probably you have something weird in it, as per error message:

Refusing to install package with name "delete-test-01" under a package
also called "delete-test-01". Did you name your project the same
as the dependency you're installing?