为什么 NPM 无法在 Ubuntu 上安装 Socket.io?

为什么 NPM 无法在 Ubuntu 上安装 Socket.io?

我在 Win7 上使用 VMPlayer 安装了 Ubuntu v11.04。我刚刚完成了 NodeJS v0.5.4-pre 和 NPM v1.0.22 的全新安装。尝试安装 Socket.io 时,我收到以下信息:

ohad@ubuntu:~$ sudo npm install socket.io
npm ERR! registry error parsing json
npm ERR! SyntaxError: Unexpected token H
npm ERR! Host not found
npm ERR!     at Object.parse (native)
npm ERR!     at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/npm-registry-client/request.js:167:25)
npm ERR!     at IncomingMessage.emit (events.js:88:20)
npm ERR!     at HTTPParser.onMessageComplete (http2.js:133:23)
npm ERR!     at CleartextStream.ondata (http2.js:1095:22)
npm ERR!     at CleartextStream._push (tls.js:328:27)
npm ERR!     at SecurePair.cycle (tls.js:617:20)
npm ERR!     at EncryptedStream.write (tls.js:121:13)
npm ERR!     at Socket.ondata (stream.js:36:26)
npm ERR!     at Socket.emit (events.js:67:17)
npm ERR! Report this *entire* log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <[email protected]>
npm ERR! 
npm ERR! System Linux 2.6.38-10-generic
npm ERR! command "node" "/usr/local/bin/npm" "install" "socket.io"
npm ERR! cwd /home/ohad
npm ERR! node -v v0.5.4-pre
npm ERR! npm -v 1.0.22
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/ohad/npm-debug.log
npm not ok

有任何想法吗?

答案1

这个失败是因为node的git master版本有bug,不稳定,解决办法是运行稳定版本0.4:

git 克隆https://github.com/joyent/node.git&& cd 节点

git checkout origin/v0.4

。/配置

制作

安装

节点-v

卷曲http://npmjs.org/install.sh| sudo sh

此后,npm 应该可以按照文档所述运行。

答案2

https-git 地址已关闭 - 稍后再试...

相关内容