npm -v
npm WARN config global --global, --local are deprecated. Use --location=global instead.
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module ‘semver’
Hi , I am getting the node and npm version on my local computer but on jenkins i am only getting the node version , where as for npm version its showing the above error.
I checked with the global variables and also configured Node Installations in Tools .
Please suggest some ideas to resolve this error … Thanks in advance for the suggestions
I’m not an expert on npm at all, to say the truth, for me it’s always a pain in the neck to use it.
Anyway.
The error message you provided seems to indicate that there is a missing module called semver in your Jenkins environment.
If you have access to your agent, first update npm:
npm install -g npm@latest
Then check is npm is installed where your pipeline expects it to be:
which npm
Then you could go with the install of semver itself: