安装yeoman出现错误npm ERR! [email protected] postinstall: `yodoctor`

86337360 2016-04-12

npmERR!Darwin15.4.0

npmERR!argv"/usr/local/bin/node""/usr/local/bin/npm""install""yo""-g"

npmERR!nodev4.4.2

npmERR!npmv3.8.6

npmERR!filesh

npmERR!codeELIFECYCLE

npmERR!errnoENOENT

npmERR!syscallspawn

[email protected]:`yodoctor`

npmERR!spawnENOENT

npmERR!

[email protected]'yodoctor'.

npmERR!Makesureyouhavethelatestversionofnode.jsandnpminstalled.

npmERR!Ifyoudo,thisismostlikelyaproblemwiththeyopackage,

npmERR!notwithnpmitself.

npmERR!Telltheauthorthatthisfailsonyoursystem:

npmERR!yodoctor

npmERR!Youcangetinformationonhowtoopenanissueforthisprojectwith:

npmERR!npmbugsyo

npmERR!Orifthatisn'tavailable,youcangettheirinfovia:

npmERR!npmownerlsyo

npmERR!Thereislikelyadditionalloggingoutputabove.

npmERR!Pleaseincludethefollowingfilewithanysupportrequest:

npmERR!/Users/LiYunpeng/npm-debug.log

参看

https://docs.npmjs.com/getting-started/fixing-npm-permissions

通过命令行查看

npmconfiggetprefix

如果是user/local则可以执行下面的语句,如果只是user那么采用第二种方式(将node的文件夹移走)

sudochown-R$(whoami)$(npmconfiggetprefix)/{lib/node_modules,bin,share}

将对应的文件夹授权

变量whoami就是当前用户的文件夹位置,npmconfiggetprefix就是npm中配置的安装目录前缀

然后执行cd&&npminstallyo-g

貌似如果之前安装过yo,在/usr/local/bin/下已经存在yo的情况下,执行npminstallyo-g会不允许,所以要cd&&