2013-05-01 49 views
20

這是事情。我的配置是Ubuntu 13.04,Node.js v0.10.5和NPM版本1.2.18。Node-waf:找不到

我試圖安裝Node.js的模塊「鞋」,我得到這個錯誤:

[email protected]:/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]) 
[email protected]:/media/tc/examples/node/05.01$ 

我在谷歌上搜索,我發現節點WAF與節點GYP取代。我還發現,節點-WAF可以

sudo apt-get install nodejs-dev 

的問題是,我使用其中不包括再dev下最新的node.js package by Chris Lea安裝。所以有兩種方法可以解決這個問題。

首先,我可以安裝node-waf(來自源代碼?),但我不知道如何。

其次,我可以(手動)修復模塊,但我不怎麼樣。

我正在尋找任何解決方案。

+0

查看http://stackoverflow.com/questions/15024421/node-js-centos-node-waf/15979279#15979279 – 2013-05-01 12:24:35

回答

2

它實際上是rbytes這是造成這個問題。

使其更加複雜:rbytes不是shoe的直接依賴關係,而是sockjs。並且looking at the code,那也應該沒有rbytes功能。

由於鞋聲明是作爲可選依賴,shoe不會得到安裝:

npm WARN optional dep failed, continuing [email protected] 
     ^^^^^^^^    ^^^^^^^^^^   

所以,你就應該能夠不顧警告使用它。

+0

謝謝你的回答。儘管有警告,但我不知道我可以使用「鞋子」。這基本上解決了我的問題。無論如何,我仍然在尋找我的兩個問題的答案。我在哪裏可以得到node-waf,或者如何在沒有NPM的情況下安裝模塊。 – Marek 2013-05-02 18:32:52

+2

'node-waf'已被0.8節點棄用;它的替代品'node-gyp'無法建立'rbytes'(我嘗試過:克隆repo並使用'node-gyp configure build')。如果你真的想使用它,你可以使用[nvm](https://github.com/creationix/nvm)來安裝一個pre-0.8節點。 – robertklep 2013-05-02 19:13:28

2

我還沒有運氣在我的機器上獲得node-waf,所以我決定將它分叉並將其遷移到node-gyp,以便它可以正常工作。

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

得到它的工作,首先要確保您擁有

$ npm install node-gyp 

節點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 

我盡了最大的努力使事情奏效。如果不順利,請隨時通知我。希望能幫助到你!

11

node-waf已取代node-gyp

安裝使用節點-GYP: sudo npm install -g node-gyp

注意:要建立與節點-GYP配置文件binding.gyp是必需的。 例子:

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

更新我的'package.json'使用''engines「:{」npm「:」1.4.x「}'爲我解決了這個問題。它以前是'1.3.x'。 – Meekohi 2014-09-03 14:45:27

+0

遇到與'npm install archive'相同的問題... – Michael 2016-07-07 20:40:08

1

我只是升級我的節點版本(從0.4.4到0.6.2),問題就解決了。