我是 node.js 的新手,我已经通过从 node 网站运行安装来安装它。我已经在全球范围内安装软件包(例如应该),但现在我正在尝试在我的Mac上安装 tower 模块,如下所示:
sudo npm install tower -g
它安装了一堆东西然后崩溃,输出
npm http 304 https://registry.npmjs.org/tinycolor
npm http 304 https://registry.npmjs.org/zeparser/0.0.5
> ws@0.4.20 install /usr/local/lib/node_modules/tower/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws
> node install.js
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
node.js:520
var cwd = process.cwd();
^
Error: EACCES, permission denied
at Function.startup.resolveArgv0 (node.js:520:23)
at startup (node.js:54:13)
at node.js:611:3
npm ERR! ws@0.4.20 install: `node install.js`
npm ERR! `sh "-c" "node install.js"` failed with 11
npm ERR!
npm ERR! Failed at the ws@0.4.20 install script.
npm ERR! This is most likely a problem with the ws package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node install.js
npm ERR! You can get their info via:
npm ERR! npm owner ls ws
npm ERR! There is likely additional logging output above.
如果我没看错,那就是 ws (websockets?) 模块崩溃了。
在研究这个问题时,一个博客建议我将节点路径添加到我的 .bashrc 中,所以我已经这样做了。
有什么建议么?