事情是这样的。我的配置是Ubuntu13.04,Node.js v0.10.5和NPM版本1.2.18。
我正在尝试安装node.js模块"shoe“,我得到了这个错误:
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$我在谷歌上搜索,发现node-waf被node-gyp替换了。我还发现node-waf可以安装在
sudo apt-get install nodejs-dev问题是我使用的是最新的node.js package by Chris Lea,它不再包含dev。因此,有两种方法可以解决这个问题。
首先,我可以安装node-waf (从源代码?),但我不知道如何安装。
其次,我可以(手动)修复模块,但我不知道如何修复。
我正在寻找任何解决方案。
发布于 2013-12-01 17:31:58
node-gyp已经取代了node-waf
使用以下命令安装node-gyp:sudo npm install -g node-gyp
注意:要使用node-gyp进行构建,需要配置文件binding.gyp。示例:
{
"targets": [
{
"target_name": "binding",
"sources": [ "src/binding.cc" ]
}
]
}发布于 2013-05-01 20:44:56
实际上是rbytes导致了这个问题。
更复杂的是:rbytes不是shoe的直接依赖项,而是sockjs的依赖项。和looking at the code,没有rbytes也应该可以工作。
因为shoe声明是一个可选的依赖项,所以shoe确实会被安装:
npm WARN optional dep failed, continuing rbytes@0.0.2
^^^^^^^^ ^^^^^^^^^^ 因此,无论出现什么警告,您都应该能够使用它。
发布于 2013-06-26 19:44:30
我没有幸运地在我的机器上获得node-waf,所以我决定派生这个东西,并将它迁移到node-gyp,这样它就可以工作了。
我的分叉在https://github.com/eddydas/node-sleep
要让它正常工作,首先要确保使用node-gyp by
$ 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我尽了最大的努力让这件事顺利进行。如果进展不顺利,请随时告诉我。希望它能帮上忙!
https://stackoverflow.com/questions/16317976
复制相似问题