【问题标题】:Mac cant install socket.io with npm/nodejs?Mac 无法使用 npm/nodejs 安装 socket.io?
【发布时间】:2014-04-04 05:10:44
【问题描述】:

我已经搜索了几个小时,但我仍然没有解决这个问题。 我有 mac os x 版本 10.6.8 我从 nodejs.org 安装了 nodejs。版本为 v0.6.14。 我在终端中执行此操作以检查 npm:npm --version。 npm 版本是 1.1.12 之后我尝试了 npm install socket.io 并收到此错误...

pm http GET https://registry.npmjs.org/socket.io
npm http 304 https://registry.npmjs.org/socket.io
npm http GET https://registry.npmjs.org/socket.io-client/0.9.3
npm http GET https://registry.npmjs.org/policyfile/0.0.4
npm http GET https://registry.npmjs.org/redis/0.6.7
npm http 304 https://registry.npmjs.org/redis/0.6.7
npm http 304 https://registry.npmjs.org/policyfile/0.0.4
npm http 304 https://registry.npmjs.org/socket.io-client/0.9.3
npm http GET https://registry.npmjs.org/uglify-js/1.2.5
npm http GET https://registry.npmjs.org/ws
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 304 https://registry.npmjs.org/ws
npm http 304 https://registry.npmjs.org/active-x-obfuscator/0.0.1
npm http 304 https://registry.npmjs.org/xmlhttprequest/1.2.2
npm http 304 https://registry.npmjs.org/uglify-js/1.2.5
npm http GET https://registry.npmjs.org/zeparser/0.0.5

> ws@0.4.11 preinstall /Users/NAME/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws
> make

execvp(): No such file or directory

npm ERR! Error: ENOENT, open '/Users/NAME/node_modules/socket.io/node_modules/socket.io-client/node_modules/uglify-js/test/unit/compress/test/array1.js'
npm ERR! You may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <npm-@googlegroups.com>
npm ERR! 
npm ERR! System Darwin 10.8.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "socket.io"
npm ERR! cwd /Users/NAME
npm ERR! node -v v0.6.14
npm ERR! npm -v 1.1.12
npm ERR! path /Users/NAME/node_modules/socket.io/node_modules/socket.io-client/node_modules/uglify-js/test/unit/compress/test/array1.js
npm ERR! code ENOENT
npm ERR! message ENOENT, open '/Users/NAME/node_modules/socket.io/node_modules/socket.io-client/node_modules/uglify-js/test/unit/compress/test/array1.js'
npm ERR! errno {}

npm ERR! ws@0.4.11 preinstall: `make`
npm ERR! `sh "-c" "make"` failed with 127
npm ERR! 
npm ERR! Failed at the ws@0.4.11 preinstall 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!     make
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 Darwin 10.8.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "socket.io"
npm ERR! cwd /Users/NAME
npm ERR! node -v v0.6.14
npm ERR! npm -v 1.1.12
npm ERR! code ELIFECYCLE
npm ERR! message ws@0.4.11 preinstall: `make`
npm ERR! message `sh "-c" "make"` failed with 127
npm ERR! errno {}
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/NAME/npm-debug.log
npm not ok

请帮忙!

【问题讨论】:

  • 在 Mac OSX 10.6.8 上出现同样的错误 ..

标签: macos node.js socket.io


【解决方案1】:

使用强制安装

npm install socket.io -f

看起来测试需要 node-waf,但不需要库。我希望他们最终能解决这些问题。

【讨论】:

    【解决方案2】:

    Socket.io 在安装时运行 make 并且需要 node-waf 才能运行。你是通过ports之类的包管理器安装node,还是使用node网站上的dmg安装?

    此主题讨论了您遇到的问题:

    https://github.com/LearnBoost/socket.io/issues/773

    【讨论】:

    • 我从 nodejs.org 安装了 node-v0.6.14.pkg。所以我想我用包管理器安装了它?但是我该如何解决这个错误?我需要 nodejs-dev 来获取 node-waf?
    【解决方案3】:

    似乎如果您安装了早期版本的socket.io,则无需运行make 脚本。我尝试了以下方法并设法在我的 Mac OSX 10.6.8 上成功安装:

    npm install socket.io@0.7
    

    this google groups post有进一步讨论。

    【讨论】:

      猜你喜欢
      • 2013-05-04
      • 2016-03-26
      • 2015-07-23
      • 1970-01-01
      • 1970-01-01
      • 2017-12-07
      • 1970-01-01
      • 2019-05-27
      • 2016-08-14
      相关资源
      最近更新 更多