yo: Error on installing yo package "npm install -g yo" - Failed at the yo@1.6.0 postinstall script 'yodoctor'
Hi guys, I got some trouble on installing Yeoman 1.6.0
Here my environement set :
- Macbook Air Mavericks (10.9.5)
- Fresh install of node and npm via node pkg installer -> https://nodejs.org/en/
- echo $PATH => /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin
- node -e ‘console.log(process.platform, process.versions)’ =>
darwin { http_parser: '2.6.0', node: '5.4.1', v8: '4.6.85.31', uv: '1.8.0', zlib: '1.2.8', ares: '1.10.1-DEV', icu: '56.1', modules: '47', openssl: '1.0.2e' } - npm -v => 3.5.3
Here the output error on installing =>
MacBook-Air-de-Farah:~ farah$ sudo npm install -g yo npm WARN deprecated npmconf@2.1.2: this package has been reintegrated into npm and is now out of date with respect to npm /usr/local/bin/yo -> /usr/local/lib/node_modules/yo/lib/cli.js
yo@1.6.0 postinstall /usr/local/lib/node_modules/yo yodoctor
env: node: No such file or directory npm ERR! Darwin 13.4.0 npm ERR! argv “/usr/local/bin/node” “/usr/local/bin/npm” “install” “-g” “yo” npm ERR! node v5.4.1 npm ERR! npm v3.5.3 npm ERR! file sh npm ERR! code ELIFECYCLE npm ERR! errno ENOENT npm ERR! syscall spawn
npm ERR! yo@1.6.0 postinstall:
yodoctornpm ERR! spawn ENOENT npm ERR! npm ERR! Failed at the yo@1.6.0 postinstall script ‘yodoctor’. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the yo package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! yodoctor npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs yo npm ERR! Or if that isn’t available, you can get their info via: npm ERR! npm owner ls yo npm ERR! There is likely additional logging output above.npm ERR! Please include the following file with any support request: npm ERR! /Users/farah/npm-debug.log

I can install other npm package without troubles.
Node and npm are both already up to date.
I already completely uninstall and reinstall node and npm.
I also trying clean npm cache using npm cache clean -f before run npm install -g yo
I also followed some same bug issue https://github.com/yeoman/yo/issues/213 and https://github.com/yeoman/yeoman/issues/1439 but no one resolved my problem
I even tried to install with the first node version available for yo@1.6.0 which is node v.012.0 but I got exactly the same error

Then I get back to my latest node version (5.4.1), I installed “yeoman-doctor” via npm install yeoman-doctor with success.
Here is the output of yodoctor

I retrying to install “yo” npm install -g yo but I got exactly the same error as the begening.
Any help ? ^^
Thanks, best regards
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 3
- Comments: 25 (7 by maintainers)
Looks like a bug/race condition on npm. You should open an issue over there so it get fixed.
In the meantime, you can run
npm i -g yeoman-doctorbefore installing yo. This should fix the issue.Thanks for reply
I just fixed my issue using the following command =>
sudo chown -R $USER /usr/localI clean cache =>
npm cache clean -fThen the install has been perform with success
But can someone explain me why on using
sudo npm install -g yoI got troubles ? I don’t understand. What is the difference between setsudo chown -R $USER /some/pathand using directlysudoon command line ?Thanks