I can\'t use npm install
using the command prompt in NodeJS. I\'m getting these errors when running npm install
:
module.js:339
For me, this happened after I installed yarn globally. To resolve this issue, install npm using yarn and done.
yarn global add npm
As noted by anonymous(?) at DeveloperReference.com, the steps below resolved the "cannot find module 'semver'" for me when running npm -install:
*"I followed These steps and it solved my issue uninstall Node.js
Having just encountered this on Arch Linux 4.13.3, I solved the issue by simply reinstalling semver
:
pacman -S semver
For me, it happened while upgrading to gulp 4 from gulp 3 in my project. So, when I run "gulp watch" command, it was throwing me same error.
It's probably due to version mismatch as compared to my globally installed gulp.
So, either upgrading gulp with "-g" global flag would help, or else I followed this below
However, I used "./node_modules/.bin/gulp watch" in my project. This ensures that all the dependencies that gulp needs are taken from node_modules only.
I had the same issue installing on AWS Linux. I had to install it with sudo
. So to get around this I followed step 3 from this article (making sure to get the latest version of node)
https://www.hostingadvice.com/how-to/update-node-js-latest-version/
wget https://nodejs.org/dist/vx.x.x/node-vx.x.x-linux-x64.tar.xz
tar -C /home/aUser/node --strip-components 1 -xJf node-vx.x.x-linux.x64.tar.xz
But installed it to the user's home directory /home/aUser/node
. Then added that path to my PATH.
export PATH=/home/aUser/node/bin:$PATH
After that I was able to do an npm install
with no issues.
I had this too, after running brew install yarn
yesterday. At least, everything was fine up until then.
I ran rm -rf node_modules
and tried to reinstall, but no npm
command was working.
In the end I took the rather simple step of reinstalling Node via the official Node installer for Mac OS X.
https://nodejs.org/en/download/
Everything is fine now. Just went back to the directory, ran npm install
and it's done the trick.