[英]Cannot npm install 'mean-cli' module on Mac OS X
更新:顯然,使用sudo
安裝節點模塊是一種不好的做法。 而是,更改文件夾權限將解決此問題。
在此處查看答案: https : //stackoverflow.com/a/31546496/2859315
原始帖子:
目前,我已經安裝了Node(版本v0.12.7)和NPM。 我正在嘗試從NPM安裝mean-cli
軟件包。
我正在按照此處的安裝說明進行操作: https : //github.com/linnovate/mean#installation
另外,我正在參加有關Udemy的MEAN Stack開發課程。 這是講座: https : //www.udemy.com/mean-stack-for-beginners/#/lecture/2697540
到目前為止,我已經安裝了兩個必備軟件包Gulp和Bower:
$ npm install -g gulp
// and bower
$ npm install -g bower
首先,我嘗試使用npm install -g mean-cli
進行npm install -g mean-cli
但是這引發了權限錯誤,而沒有使用sudo
。 然后,即使使用sudo
也行不通。
其次,我嘗試更新並重新安裝節點和NPM。 仍然有同樣的問題。
當我輸入命令sudo npm install -g mean-cli
,
我得到這個回應:
> mean-cli@0.10.14 preinstall /usr/local/lib/node_modules/mean-cli
> node ./scripts/preinstall
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
node.js:720
var cwd = process.cwd();
^
Error: EACCES, permission denied
at Error (native)
at Function.startup.resolveArgv0 (node.js:720:23)
at startup (node.js:63:13)
at node.js:814:3
npm ERR! Darwin 14.4.0
npm ERR! argv "node" "/usr/local/bin/npm" "install" "-g" "mean-cli"
npm ERR! node v0.12.7
npm ERR! npm v2.11.3
npm ERR! code ELIFECYCLE
npm ERR! mean-cli@0.10.14 preinstall: `node ./scripts/preinstall`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mean-cli@0.10.14 preinstall script 'node ./scripts/preinstall'.
npm ERR! This is most likely a problem with the mean-cli package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node ./scripts/preinstall
npm ERR! You can get their info via:
npm ERR! npm owner ls mean-cli
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Library/WebServer/Documents/NodeJS/mean/npm-debug.log
似乎問題出在這里: Failed at the mean-cli@0.10.14 preinstall script 'node
,但是我不確定如何進一步調試它。
任何見解或有用的信息表示贊賞! 謝謝!
顯然,使用sudo
安裝節點模塊是一種不好的做法。 而是,更改文件夾權限將解決此問題。
在此處查看答案: https : //stackoverflow.com/a/31546496/2859315
要回收/ usr / local的所有權,請使用以下命令
Sudo chown –r $ USER / usr / local
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.