2012-07-11 70 views
1

我是node.js的新手,我通过从节点网站运行安装来安装它。我有一个游戏安装包在全球范围(如应该),但现在我想在我的Mac 安装塔模块,像这样:安装塔模块时遇到的问题-WS模块崩溃

sudo npm install tower -g 

它安装了一堆东西,然后崩溃,与输出

npm http 304 https://registry.npmjs.org/tinycolor 
npm http 304 https://registry.npmjs.org/zeparser/0.0.5 

> [email protected] 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! [email protected] install: `node install.js` 
npm ERR! `sh "-c" "node install.js"` failed with 11 
npm ERR! 
npm ERR! Failed at the [email protected] 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中,所以我已经完成了这个工作。

有什么建议吗?

+0

我会尝试安装节点与自制软件,一切都很顺利,然后。 'brew install node' – 2012-08-01 07:18:36

回答

0

多次实验后,只有为我工作的事就是enable the OSX root account,然后:

su 
npm install -g tower 

须藤没有工作,但苏做到了。

1

在这一行:

[email protected] install /usr/local/lib/node_modules/tower/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws

我们看到,WS是安装在/ usr/local/lib目录,我需要root写在这里没有?

我使用Linux,它也许不是在MAC的情况下...

您应该使用sudo npm install -g towernvm安装Node.js的。 Nvm关心模块安装在你的家里,所以你不需要sudo。

+0

是的,正如我所说的,我确实使用了sudo。 – 2012-07-12 09:18:05