i tried to install grunt on a mac with Yosemite. node is already installed in the newest version. if i type "node -v" in the terminal i get the line v0.12.5. thats good. but when i want to install something with npm i get only a error...
i tried "sudo npm install -g grunt-cli", "sudo npm install npm -g" and also with "npm -v" i get always this error...
Error: Cannot find module 'are-we-there-yet'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/usr/local/Cellar/node/0.10.22/lib/node_modules/npm/node_modules/npmlog/log.js:2:16)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
someone knows what's the problem or better a solution?
You could also reinstall
node
fromhttps://nodejs.org/en/download/current/
I followed the instructions above (what eush77 said) to remove the npm folder in the node_modules folder. But there remains the broken link resulting in this error message.
/usr/local/bin/npm: No such file or directory
so remove the broken link:
rm /usr/local/bin/npm
and then make it point to the right place like this:
sudo ln -s /usr/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm
I got it reset by using the official installer package found: https://nodejs.org/en/
Playing around with n and nvm eventually corrupted the node_modules packages for me by providing packages incompatible with current Node version.
I suspect it'd work for other environments as it couples both Node AND npm install.
I just had the same problem while deploying the project on local server when I was invoking the
yarn dev
command.After going through all the blogs, articles and stuff I got it working just by simple this 2 commands.
npm list
check at what version it is pointing right now. For me, when I was getting this error. It was pointing to the system.I just used the
nvm use v{VERSION}
e.g.nvm use v10.5.0
(for me) and it got working. All the errors went away and the project got deployed successfully while invoking theyarn dev
. Try this before doing anything else. I highly recommend.What eush77 said, but if you're on Windows:
download the latest package from https://nodejs.org/download/release/npm/
unpack, and replace the "npm" directory in the nodejs node-modules directory (by default C:\Program Files\nodejs\node_modules)
For me this had to do with installations being corrupted and perhaps ubuntu repositories not being compatible or the most recent. The following resulted in a working npm/node install:
sudo curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash - sudo apt-get install -y nodejs
https://github.com/nodesource/distributions