node.js 节点waf:未找到
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16317976/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Node-waf: not found
提问by Marek
Here is the thing. My configuration is Ubuntu 13.04, Node.js v0.10.5 and NPM version 1.2.18.
这是事情。我的配置是 Ubuntu 13.04、Node.js v0.10.5 和 NPM 版本 1.2.18。
I am trying to install node.js module "shoe" and I got this error:
我正在尝试安装 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
> [email protected] 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 [email protected]
[email protected] node_modules/shoe
├── [email protected]
└── [email protected] ([email protected], [email protected])
marek@nassenfuss:/media/tc/examples/node/05.01$
I was googling and I found that node-waf was replaced with node-gyp. I also found that node-waf can be installed with
我在谷歌上搜索,发现 node-waf 被 node-gyp 替换了。我还发现可以安装 node-waf
sudo apt-get install nodejs-dev
The problem is that I am using the lastest node.js package by Chris Leawhich does not include dev anymore. So there are two options to solve the problem.
问题是我使用的是 Chris Lea的最新node.js 包,它不再包含 dev。所以有两种选择来解决这个问题。
First, I could install node-waf (from source?), but I do not how.
首先,我可以安装 node-waf(从源代码?),但我不怎么安装。
Second, I could (manually) repair the module, but I do not how.
其次,我可以(手动)修复模块,但我不知道如何修复。
I am looking for any solution.
我正在寻找任何解决方案。
回答by Amadu Bah
node-wafhas been replaced by node-gyp
node-waf已被替换 node-gyp
Install node-gyp using:
sudo npm install -g node-gyp
使用以下命令安装 node-gyp:
sudo npm install -g node-gyp
Note: To build with node-gyp the configuration file binding.gypis required.
Example:
注意:要使用 node-gyp 构建,binding.gyp需要配置文件。例子:
{
"targets": [
{
"target_name": "binding",
"sources": [ "src/binding.cc" ]
}
]
}
回答by robertklep
It's actually rbytesthat's causing the issue.
实际上是rbytes导致了这个问题。
To make it even more complex: rbytesisn't a direct dependency for shoe, but for sockjs. And looking at the code, that should function without rbytestoo.
让它变得更加复杂:rbytes不是直接依赖于shoe,而是直接依赖于sockjs。并查看代码,该代码也应该可以正常运行rbytes。
Since shoe declares is as an optionaldependency, shoedoes get installed:
由于 shoes 声明是一个可选的依赖项,shoe所以会安装:
npm WARN optional dep failed, continuing [email protected]
^^^^^^^^ ^^^^^^^^^^
So you should just be able to use it regardless of the warning.
因此,无论警告如何,您都应该能够使用它。
回答by ewcy
I haven't had luck getting node-waf on my machine, so I decided to fork the thing and migrate it to node-gyp so that it works.
我没有在我的机器上获得 node-waf 的运气,所以我决定分叉这个东西并将它迁移到 node-gyp 以便它工作。
My fork is at https://github.com/eddydas/node-sleep
我的叉子在https://github.com/eddydas/node-sleep
To get it work, first make sure you have node-gyp by
为了让它工作,首先确保你有 node-gyp
$ npm install node-gyp
Then, clone the entire project from GitHub (either by ZIP or Git, it's up to you) and install from it.
然后,从 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
I tried my best to make the thing work. If it doesn't go smooth, please feel free to let me know. Hope it helps!
我尽力让这件事奏效。如果不顺利,请随时告诉我。希望能帮助到你!
回答by griffon vulture
I simply upgraded my node version (from 0.4.4 into 0.6.2), problem was resolved.
我只是升级了我的节点版本(从 0.4.4 到 0.6.2),问题解决了。

