繁体   English   中英

节点waf:未找到

[英]Node-waf: not found

这是事情。 我的配置是 Ubuntu 13.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

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

首先,我可以安装 node-waf(从源代码?),但我不怎么安装。

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

我正在寻找任何解决方案。

node-waf已替换node-gyp

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

注意:要使用 node-gyp 构建,需要配置文件binding.gyp 例子:

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

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

更复杂的是: rbytes不是shoe的直接依赖项,而是sockjs的直接依赖sockjs 查看代码,它也应该在没有rbytes情况下rbytes

由于 shoes 声明是一个可选的依赖项,所以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),问题解决了。

安装节点 lts 版本为我解决了这个问题

npm install n -g

sudo n lts

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM