Building a node project, using serverless
Firstly I get the error
Error:
Error: npm ls -prod -json -depth=1 failed with code 1
at ChildProcess.<anonymous> (/Users/jrobens/NetBeansProjects/azuron/winpay/winpay-
uploader/node_modules/serverless-webpack/lib/utils.js:91:16)
To find our more information I enter npm ls -prod -json -depth=1 and get
npm ERR! code ELSPROBLEMS
npm ERR! invalid: serverless#3.2.1
/my-project/node_modules/serverless
{
It looks as though webpack worked
webpack compiled successfully in 4581 ms
About the environment: node-14, typescript, aws
├── #serverless/typescript#3.2.0
├── #types/serverless#3.0.0
├── serverless-apigw-binary#0.4.4
├── serverless-certificate-creator#1.6.0
├── serverless-dynamodb-local#0.2.40
├── serverless-http#2.7.0
├── serverless-iam-roles-per-function#3.2.0
├── serverless-plugin-aws-alerts#1.7.4
├── serverless-prune-plugin#2.0.1
├── serverless-s3-local#0.6.21
├── serverless-webpack#5.6.1
Fixing this
npm ls -prod json
produces a json list of the packages. The -depth=1 flag brought an error to light. There was an invalid package.
Find the invalid package by
npm ls
and fix any error messages.
In my case there was an old serverless plugin that had a dependency of a different version of serverless.
I got the same error then updated angular and that solved it.
$ ng update
I fixed removing packages-lock.json and then doing npm install.
Not sure if this is the best way to fix it, but it worked for me.
Related
Here's the URL: https://github.com/awslabs/aws-solutions-constructs/tree/main/source/use_cases/aws-custom-glue-etl
I'm not so familiar with node, but I've installed nvm using brew, installed the 'node' target, and see these packages for npm ls -g:
npm ls -g
/Users/jnorment/.nvm/versions/node/v18.4.0/lib
├── #aws-solutions-constructs/aws-cust0m-glue-etl#0.0.0 -> ./../../../../../proj/public-cloud-workenv/aws-solutions-constructs/source/use_cases/aws-custom-glue-etl
├── aws-cdk-lib#2.30.0
├── aws-cdk#2.30.0
├── constructs#10.1.43
├── corepack#0.11.2
├── npm#8.13.2
└── ts-node#10.8.2
Here's what npm ls looks like from the new app's directory:
├── #types/jest#27.5.2
├── #types/node#10.17.27
├── #types/prettier#2.6.0
├── aws-cdk-lib#2.30.0
├── aws-cdk#2.30.0
├── constructs#10.1.43
├── jest#27.5.1
├── source-map-support#0.5.21
├── ts-jest#27.1.5
├── ts-node#10.8.2
└── typescript#3.9.10
Here's what npm ls looks like from the solution's directory:
npm ls
#aws-solutions-constructs/aws-cust0m-glue-etl#0.0.0 /Users/jnorment/proj/public-cloud-workenv/aws-solutions-constructs/source/use_cases/aws-custom-glue-etl
├── UNMET DEPENDENCY #aws-cdk/aws-glue#1.162.0
├── UNMET DEPENDENCY #aws-cdk/aws-iam#1.162.0
├── UNMET DEPENDENCY #aws-cdk/aws-kinesis#1.162.0
├── UNMET DEPENDENCY #aws-cdk/aws-logs#1.162.0
├── UNMET DEPENDENCY #aws-cdk/aws-s3-assets#1.162.0
├── UNMET DEPENDENCY #aws-cdk/core#0.0.0
├── UNMET DEPENDENCY #aws-solutions-constructs/aws-kinesisstreams-gluejob#0.0.0
├── UNMET DEPENDENCY #aws-solutions-constructs/core#0.0.0
├── UNMET DEPENDENCY #types/jest#^24.9.1
├── UNMET DEPENDENCY #types/node#^10.3.0
└── UNMET DEPENDENCY source-map-support#^0.5.16
npm ERR! code ELSPROBLEMS
npm ERR! missing: #aws-cdk/aws-glue#1.162.0, required by #aws-solutions-constructs/aws-cust0m-glue-etl#0.0.0
npm ERR! missing: #aws-cdk/aws-iam#1.162.0, required by #aws-solutions-constructs/aws-cust0m-glue-etl#0.0.0
npm ERR! missing: #aws-cdk/aws-kinesis#1.162.0, required by #aws-solutions-constructs/aws-cust0m-glue-etl#0.0.0
npm ERR! missing: #aws-cdk/aws-logs#1.162.0, required by #aws-solutions-constructs/aws-cust0m-glue-etl#0.0.0
npm ERR! missing: #aws-cdk/aws-s3-assets#1.162.0, required by #aws-solutions-constructs/aws-cust0m-glue-etl#0.0.0
npm ERR! missing: #aws-cdk/core#0.0.0, required by #aws-solutions-constructs/aws-cust0m-glue-etl#0.0.0
npm ERR! missing: #aws-solutions-constructs/aws-kinesisstreams-gluejob#0.0.0, required by #aws-solutions-constructs/aws-cust0m-glue-etl#0.0.0
npm ERR! missing: #aws-solutions-constructs/core#0.0.0, required by #aws-solutions-constructs/aws-cust0m-glue-etl#0.0.0
npm ERR! missing: #types/jest#^24.9.1, required by #aws-solutions-constructs/aws-cust0m-glue-etl#0.0.0
npm ERR! missing: #types/node#^10.3.0, required by #aws-solutions-constructs/aws-cust0m-glue-etl#0.0.0
npm ERR! missing: source-map-support#^0.5.16, required by #aws-solutions-constructs/aws-cust0m-glue-etl#0.0.0
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/jnorment/.npm/_logs/2022-07-06T21_55_24_889Z-debug-0.log
I'm able to run cdk init app --language typescript and cdk deploy for the resulting app, so I think this might be a case of the example app itself being broken. The versions on a number of the dependencies are 0.0.0; this appears to reinforce my hypothesis.
If I can possibly get this working, that would be great, because it's half of exactly what I want to figure out how to build in AWS for my current project.
I'm also looking for information to expand my development horizons: is using a version of 0.0.0 a common thing for node developers to do? Or does it even have a wider scope? I think it's a little weird because it means that I can't run code committed to main that otherwise looks like it would work. How are the developers even running it? I assume there must be a way ...
If it turns out to be un-runnable, does anyone know a minimal example of a glue streaming job that I can get working in a new AWS account?
Also, might I suggest a new tag for this? aws-cdk-constructs ?
Im working with AWS-Amplify and just updated it's CLI to the latest version, and now NPM complains that there are unmet dependencies, though graphql is clearly installed at the right version. What am missing here? Thanks for any clarification!
$ npm list -g --depth 0
/usr/local/lib
├── #aws-amplify/cli#4.12.0
├── #vue/cli#4.0.5
├── browser-sync#2.26.7
├── firebase-tools#7.10.0
├── graphql#14.5.8
├── nodemon#2.0.2
├── npm#6.13.6
└── parcel-bundler#1.12.4
npm ERR! peer dep missing: graphql#^14.5.8, required by #graphql-toolkit/file-loading#0.9.0
npm ERR! peer dep missing: graphql#^14.2.0, required by relay-compiler#6.0.0
This happens when your node version is not latest or when the dependencies require a certain version of other npm. Just check if all the npm packages and node is of latest version.
I'm linking my-lib to see effects in my-app right away.
cd my-lib-folder
npm link
cd ../my-app-folder
npm link my-lib
This works as expected. Changes are picked up by my-app and I see the symlink in node_modules. My problem is that in my-app-folder/, npm list --link=true shows up empty. How can I get a list of the linked modules?
npm ls my_lib
my-app#3.1.0 /Users/path/my_project
└── UNMET DEPENDENCY my-lib#3.7.0
npm ERR! missing: my-lib#3.7.0, required by my-app#3.1.0
This happens both with Node 8 and 10 and their respective npm versions.
OK, I realized that my-lib was somehow linked globally
$ npm ls -g --link=true --depth=0
/Users/apth/.nvm/versions/node/v8.11.4/lib
└── my-lib#3.1.0 -> /Users/franzih/code/my-lib-folder
Unlinking it with npm unlink -g my-lib and linking it again worked and it now shows up as local link:
$ npm ls --link=true
my-app#3.1.0 /Users/path/code/my-app-folder
└─┬ my-app#3.7.0 -> /Users/path/.nvm/versions/node/v8.11.4/lib/node_modules/my-lib-folder
├─┬ https-proxy-agent#2.2.1
│ ├─┬ agent-base#4.2.1
│ │ └─┬ es6-promisify#5.0.0
│ │ └── es6-promise#4.2.4
│ └─┬ debug#3.1.0
│ └── ms#2.0.0
└── node-fetch#2.2.0
Now npm i does not overwrite the link anymore. All good.
In my case, "my-lib" was not linked globally, but I had to:
Uninstall it completely from "my-app" (npm uninstall my-lib)
npm link my-lib from "my-app", and then
Run npm install my-lib in "my-app"
Every other combination of steps did not work, and I did not find the uninstall or reinstall documented anywhere. Hope this helps anyone else running into this problem.
After npm install on clean environment, I get following problem with b package:
npm ls b
a#2.0.6
├── b#3.0.0
├─┬ c#3.0.1
│ └── UNMET DEPENDENCY b#^1.0.0
└─┬ d#4.1.1
└─┬ c#2.1.0
└── UNMET DEPENDENCY b#^1.0.0
npm ERR! missing: b#^1.0.0, required by c#3.0.1
npm ERR! missing: b#^1.0.0, required by c#2.1.0
This obviously causes errors, as package c needs b#^1.0.0, but receives b#3.0.0.
I struggled to force npm to install both versions as if they were different packages. Tried going through npm docs, package-locks, and shinkwrap, but with no success. How can I solve this problem?
Environment info:
OS: macOS High Sierra 10.13.4
npm: 6.10
node: v8.8.1
Playing around I noticed, that a lot of packages had UNMET DEPENDENCY. Following procedure fixed the problem:
rm -rf node_modules
npm cache clean --force
npm install
After cleaning npm cache the issue is completely resolved:
a#2.0.6
├── b#3.0.0
├─┬ c#3.0.1
│ └── b#^1.0.0
└─┬ d#4.1.1
└─┬ c#2.1.0
└── b#^1.0.0
Strange bug.
I seem to have two versions of inherits#2.0.0, although when I tried using npm dedupe it didn't remove the invalid version. How do I fix this?
├── inherits#2.0.0
├── inherits#2.0.0 (inherits#2) invalid
> npm ERR! invalid: inherits#2.0.0 /usr/lib/node_modules/inherits#2
> npm ERR! not ok code 0
i took the easy out.
rm -rf the thing into oblivion
meh