无法在Mac OS X上npm安装'mean-cli'模块 [英] Cannot npm install 'mean-cli' module on Mac OS X
问题描述
更新:
显然,使用sudo
安装节点模块是一种不好的做法.相反,更改文件夹权限将解决此问题.
UPDATE:
Apparently, it is bad practice to use sudo
to install node modules. Instead, changing folder permissions will solve this issue.
在此处查看答案: https://stackoverflow.com/a/31546496/2859315
原始帖子:
当前,我已经安装了Node(版本v0.12.7)和NPM.我正在尝试从NPM安装mean-cli
软件包.
Currently, I have installed Node (version v0.12.7) and NPM. I am trying to install the mean-cli
package from NPM.
我正在按照此处的安装说明进行操作: https://github.com/linnovate/mean#安装
I am following the installation instructions found here: https://github.com/linnovate/mean#installation
此外,我正在参加有关Udemy的MEAN Stack开发课程.这是讲座: https://www.udemy.com/mean-stack- for-beginners/#/lecture/2697540
Also, I was taking a MEAN Stack development course on Udemy. Here is the lecture: https://www.udemy.com/mean-stack-for-beginners/#/lecture/2697540
到目前为止,我已经安装了两个必备软件包Gulp和Bower:
So far, I have installed both prerequisite packages, Gulp and Bower:
$ npm install -g gulp
// and bower
$ npm install -g bower
首先,我尝试使用npm install -g mean-cli
进行安装,但是这引发了权限错误,而没有使用sudo
.然后,即使使用sudo
也不起作用.
Firstly, I tried installing by using npm install -g mean-cli
but that threw permission errors without using sudo
. Then, even using sudo
would not work.
其次,我尝试更新并重新安装节点和NPM.仍然有同样的问题.
Secondly, I tried updating and reinstalling node and NPM. Still have the same issue.
当我键入命令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
,但是我不确定如何进一步调试它.
It seems like the problem lies here: Failed at the mean-cli@0.10.14 preinstall script 'node
, but I am not sure about how to debug this further.
任何见解或有用的信息将不胜感激!谢谢!
Any insight or helpful information is appreciated! Thanks!
推荐答案
显然,使用sudo
安装节点模块是一种不好的做法.相反,更改文件夹权限将解决此问题.
Apparently, it is bad practice to use sudo
to install node modules. Instead, changing folder permissions will solve this issue.
在此处查看答案: https://stackoverflow.com/a/31546496/2859315
这篇关于无法在Mac OS X上npm安装'mean-cli'模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!