Npm installing yo failing - node.js

I have a problem with npm install -g yo. It is giving me this error:
module.js:338
throw err;
^
Error: Cannot find module './cache/caching-client.js'
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 /usr/local/lib/node_modules/npm/lib/npm.js:22:24
at Object.<anonymous> (/usr/local/lib/node_modules/npm/lib/npm.js:466:3)
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)
I read somewhere that it might be because the NODE_PATH is incorrect so I ran this command in my terminal: "echo $NODE_PATH" and first I got the answer that my NODE_PATH was empty so I updated it to /usr/local/lib/node_modules/
Still running the command npm install -g yo fails.
Has anyone got any clue what the problem might be?

Related

how to fix broken npm after node update

I updated node to 7.9.0 with homebrew. Now whenever I do anything with npm I get the following error:
$ node -v
v7.9.0
$ npm -v
module.js:472
throw err;
^
Error: Cannot find module '../lib/utils/unsupported.js'
at Function.Module._resolveFilename (module.js:470:15)
at Function.Module._load (module.js:418:25)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at /usr/local/lib/node_modules/npm/bin/npm-cli.js:19:21
at Object.<anonymous> (/usr/local/lib/node_modules/npm/bin/npm-cli.js:79:3)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
I have tried uninstalling and reinstalling node with no change.
What can I try to recover from this?
try to remove /usr/local/lib/node_modules/npm and reinstall node again, this should work.

npm version shows Error: Cannot find module 'readable-stream'

I have installed node js on my windows 7 machine, and the version is being shown as v4.1.2 but when I am trying to run npm install or even check npm version it throwing the following error. Can any one help me where is the problem?
C:\Users\nmadasu>npm version
module.js:338
throw err;
^
Error: Cannot find module 'readable-stream'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:286:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (C:\Users\nmadasu\AppData\Roaming\npm\node_modules\npm
\node_modules\are-we-there-yet\index.js:2:14)
at Module._compile (module.js:434:26)
at Object.Module._extensions..js (module.js:452:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
After reading SO (Node.js cannot find module 'readable-stream') solutions, I tried npm install gulp -g, even this also giving same error.
C:\Users\nmadasu>npm install gulp -g
module.js:338
throw err;
^
Error: Cannot find module 'readable-stream'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:286:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (C:\Users\nmadasu\AppData\Roaming\npm\node_modules\npm
\node_modules\are-we-there-yet\index.js:2:14)
at Module._compile (module.js:434:26)
at Object.Module._extensions..js (module.js:452:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
Try:
npm install -g readable-stream
After that:
npm install gulp -g
If you can't do
npm install gulp -g
because you always have : "Cannot find module 'readable-stream'"
then, do :
sudo apt-get install npm
For me on windows the unique process that works is deleting this folders
C:\Users\YOURUSER\AppData\Roaming\npm
C:\Users\YOURUSER\AppData\Roaming\npm-cache
and Reinstall nodejs downloaded from official website
I hopoe this help to others :D

Unable to install Mean Cli on mac

I get following exception when I run sudo npm install -g mean-cli
module.js:338
throw err;
^
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.26/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)
Anyone has faced same issue? I have npm and node installed on my mac and its included in PATH

Node error trying to run yeoman

I am trying to use yeoman to scaffold for a webapp. when I try and do anything with node I get error thrown. Below is my command line output when I try and 'update node' and when i try and run 'yo webapp'. Can anyone help point out the error?
$ node update
module.js:340
throw err;
^
Error: Cannot find module '/Users/william/wdi/pixelect_project/pixelect_client_server/update'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:906:3
$ yo webapp
module.js:340
throw err;
^
Error: Cannot find module 'inquirer'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/usr/local/lib/node_modules/yo/node_modules/insight/lib/index.js:9:16)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
I had same problem. I my case helped this: npm install -g yo
For me this is also happening with other node apps as well (eg. grunt and gulp).
Reinstalling it does the trick. In this case you have to reinstall generator-webapp (npm install -g generator-webapp). If after reinstalling generator you get the same message than reinstall yeoman as levon suggested.

Error: Cannot find module '../deps/console.log'

I'm on OS X 10.8.2, with Node.js 0.10.0 installed via homebrew. When I try to run npm test on nodegit, I get the following error:
cd test && nodeunit *.js
module.js:340
throw err;
^
Error: Cannot find module '../deps/console.log'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/Users/faceleg/Work/Web/js-apprentice.com/Site/node_modules/nodegit/node_modules/.bin/nodeunit:11:1)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
npm ERR! Test failed. See above for more details.
npm ERR! not ok code 0
I've done npm update && npm -g update since installing node 0.10.0.
How might I go about fixing this?
The stack trace says it all, it's an issue with nodeunit. I'd file an issue on their issues page.
Not knowing much about nodeunit, it looks like it's anticipating being run from a different location. It's trying to require the file /Users/faceleg/Work/Web/js-apprentice.com/Site/node_modules/nodegit/node_modules/deps/console.log.js which is (probably) actually located at /Users/faceleg/Work/Web/js-apprentice.com/Site/node_modules/nodegit/node_modules/nodeunit/deps/console.log.js.

Resources