Node-waf:找不到

这是事情。 我的configuration是Ubuntu 13.04,Node.js v0.10.5和NPM版本1.2.18。

我想安装node.js模块“鞋”,我得到这个错误:

marek@nassenfuss:/media/tc/examples/node/05.01$ sudo npm install npm http GET https://registry.npmjs.org/shoe npm http 304 https://registry.npmjs.org/shoe npm http GET https://registry.npmjs.org/node-uuid/1.3.3 npm http GET https://registry.npmjs.org/faye-websocket/0.4.0 npm http GET https://registry.npmjs.org/rbytes/0.0.2 npm http 304 https://registry.npmjs.org/node-uuid/1.3.3 npm http 304 https://registry.npmjs.org/rbytes/0.0.2 npm http 304 https://registry.npmjs.org/faye-websocket/0.4.0 > rbytes@0.0.2 install /media/tc/examples/node/05.01/node_modules/shoe/node_modules/sockjs/node_modules/rbytes > node-waf configure build sh: 1: node-waf: not found npm WARN optional dep failed, continuing rbytes@0.0.2 shoe@0.0.10 node_modules/shoe ├── sockjs-client@0.0.0-unreleasable └── sockjs@0.3.1 (node-uuid@1.3.3, faye-websocket@0.4.0) marek@nassenfuss:/media/tc/examples/node/05.01$ 

我是谷歌search,我发现node-waf被replace为node-gyp。 我也发现可以安装node-waf

 sudo apt-get install nodejs-dev 

问题是我正在使用Chris Lea最新的node.js包,它不包含dev。 所以有两个select来解决这个问题。

首先,我可以安装node-waf(来自源代码?),但我不知道如何。

其次,我可以(手动)修复模块,但我不知道如何。

我正在寻找任何解决scheme。

node-waf已经被node-waf所取代

使用以下sudo npm install -g node-gyp安装node-gyp: sudo npm install -g node-gyp

注:要使用node-gyp构buildconfiguration文件binding.gyp是必需的。 例:

 { "targets": [ { "target_name": "binding", "sources": [ "src/binding.cc" ] } ] } 

这实际上是rbytes导致这个问题。

为了使它更复杂: rbytes不是shoe的直接依赖,而是sockjs 。 而看代码 ,这应该没有rbytesfunction。

由于鞋子声明是可选的依赖项,所以安装shoe

 npm WARN optional dep failed, continuing rbytes@0.0.2 ^^^^^^^^ ^^^^^^^^^^ 

所以无论警告如何,你都应该能够使用它。

我没有在我的机器上运行node-waf,所以我决定把这个东西分叉,然后把它迁移到node-gyp,这样它就可以工作。

我的叉子在https://github.com/eddydas/node-sleep

为了得到它的工作,首先确保你有node-gyp

 $ npm install node-gyp 

然后,从GitHub克隆整个项目(通过ZIP或Git,由您决定)并从中进行安装。

 $ cd ~ $ wget "https://codeload.github.com/eddydas/node-sleep/zip/master" $ unzip master $ cd YOUR_NODE_JS_PROJECT_FOLDER $ npm install ~/node-sleep-master 

我尽我所能使事情工作。 如果不顺利,请随时告诉我。 希望能帮助到你!

我只是升级了我的节点版本(从0.4.4到0.6.2),问题解决了。