I ran into the following problem when installing Yeoman:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
/usr/local/bin/yo -> /usr/local/lib/node_modules/yo/cli.js > yo@1.1.2 postinstall /usr/local/lib/node_modules/yo > node ./scripts/doctor sh: node: command not found npm ERR! yo@1.1.2 postinstall: `node ./scripts/doctor` npm ERR! Exit status 127 npm ERR! npm ERR! Failed at the yo@1.1.2 postinstall script. |
It turns out the problem was a permissions error with my node_modules directory. The following command fixed it:
sudo chown -R `whoami` /usr/local/lib/node_modules
If you think this may be the problem you can check the ownership of your directories with:
ls -l ~/.npm and ls -l /usr/local/lib/node_modules
Privileges | Owner | Group | ||||
---|---|---|---|---|---|---|
drwxr-xr-x | 4 | matthew | staff | 136 | 24 Apr 21:56 | abbrev/ |
Check that owner of the files match the whoami
command. In this case, it is indeed me. But if it isn’t you then above command will fix your node_modules
directory permissions and
sudo chown -R `whoami` ~/.npm