0

我已经安装了 NodeJs 并尝试安装 Socket.io

Socket.io 安装连续失败。我尝试了几个不同的 NodeJS 版本(0.6.15、0.6.16、0.6.17、0.7.8 。都无法安装socket.io。

完整的日志可以在pastebin上找到。

控制台日志是:

C:\Program Files (x86)\nodejs>npm install socket.io
npm http GET https://registry.npmjs.org/socket.io
npm http 304 https://registry.npmjs.org/socket.io
npm http GET https://registry.npmjs.org/policyfile/0.0.4
npm http GET https://registry.npmjs.org/socket.io-client/0.9.6
npm http GET https://registry.npmjs.org/redis/0.6.7
npm http 304 https://registry.npmjs.org/socket.io-client/0.9.6
npm http 304 https://registry.npmjs.org/redis/0.6.7
npm http 304 https://registry.npmjs.org/policyfile/0.0.4
npm http GET https://registry.npmjs.org/uglify-js/1.2.5
npm http GET https://registry.npmjs.org/xmlhttprequest/1.2.2
npm http GET https://registry.npmjs.org/active-x-obfuscator/0.0.1
npm http GET https://registry.npmjs.org/ws
npm http 304 https://registry.npmjs.org/uglify-js/1.2.5
npm http 304 https://registry.npmjs.org/xmlhttprequest/1.2.2
npm http 304 https://registry.npmjs.org/active-x-obfuscator/0.0.1
npm http 304 https://registry.npmjs.org/ws
npm http GET https://registry.npmjs.org/zeparser/0.0.5
npm http GET https://registry.npmjs.org/options
npm http GET https://registry.npmjs.org/commander
npm http 304 https://registry.npmjs.org/zeparser/0.0.5
npm http GET https://registry.npmjs.org/zeparser/-/zeparser-0.0.5.tgz
npm http 304 https://registry.npmjs.org/commander
npm http 304 https://registry.npmjs.org/options

> ws@0.4.14 install C:\Program Files (x86)\nodejs\node_modules\socket.io\node_mo
dules\socket.io-client\node_modules\ws
> node install.js

'node' is not recognized as an internal or external command,
operable program or batch file.
npm http 200 https://registry.npmjs.org/zeparser/-/zeparser-0.0.5.tgz

npm ERR! ws@0.4.14 install: `node install.js`
npm ERR! `cmd "/c" "node install.js"` failed with 1
npm ERR!
npm ERR! Failed at the ws@0.4.14 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.
npm ERR!
npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program File
s (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "socket.io"
npm ERR! cwd C:\Program Files (x86)\nodejs
npm ERR! node -v v0.7.8
npm ERR! npm -v 1.1.18
npm ERR! code ELIFECYCLE
npm ERR! message ws@0.4.14 install: `node install.js`
npm ERR! message `cmd "/c" "node install.js"` failed with 1
npm ERR! errno {}
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     C:\Program Files (x86)\nodejs\npm-debug.log
npm not ok

有解决方法吗?如何在 Windows 7 x64 上安装 Socket.IO?

4

2 回答 2

0

(适用于我0.6.15,win7 x64)

我不确定您是如何安装节点的,但您的路径中似乎没有它。尝试编辑您的 PATH 变量并添加C:\Program Files (x86)\nodejs\

另外,为什么要安装在Program Files. 这应该安装在您的项目文件夹中。如果你想全局安装一个包,你应该使用npm -g,但socket.io并不意味着全局安装。

于 2012-05-07T17:23:12.520 回答
0

在 Node.js v0.8.3 上解决的问题

于 2012-07-20T20:28:49.360 回答