mac 安装polymer cli Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/polymer-cli/node_modules/wd/build'

安装的时候根据说明,需要使用npm install -g polymer-cli命令,但是一直提示没有权限,

后来增加sudo后提示如下,

Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/polymer-cli/node_modules/wd/build'

    at Object.fs.mkdirSync (fs.js:905:18)

    at sync (/usr/local/lib/node_modules/polymer-cli/node_modules/mkdirp/index.js:71:13)

    at Object.<anonymous> (/usr/local/lib/node_modules/polymer-cli/node_modules/wd/scripts/build-browser-scripts.js:6:1)

    at Module._compile (module.js:660:30)

    at Object.Module._extensions..js (module.js:671:10)

    at Module.load (module.js:573:32)

    at tryModuleLoad (module.js:513:12)

    at Function.Module._load (module.js:505:3)

    at Function.Module.runMain (module.js:701:10)

    at startup (bootstrap_node.js:194:16)

npm ERR! code ELIFECYCLE

npm ERR! errno 1

npm ERR! wd@1.5.0 install: `node scripts/build-browser-scripts`

npm ERR! Exit status 1

npm ERR! 

npm ERR! Failed at the wd@1.5.0 install script.

npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

 

查看资料发现,可能需要增加--unsafe-perm,即

sudo npm install --unsafe-perm -g polymer-cli

结果成功了

posted on 2017-12-22 03:48  Lv Jianwei  阅读(6047)  评论(0编辑  收藏  举报