Here is the thing. My configuration is Ubuntu 13.04, Node.js v0.10.5 and NPM version 1.2.18.
I am trying to install node.js module "shoe" and I got this error:
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$
I was googling and I found that node-waf was replaced with node-gyp. I also found that node-waf can be installed with
sudo apt-get install nodejs-dev
The problem is that I am using the lastest node.js package by Chris Lea which does not include dev anymore. So there are two options to solve the problem.
First, I could install node-waf (from source?), but I do not how.
Second, I could (manually) repair the module, but I do not how.
I am looking for any solution.
node-waf
has been replaced by node-gyp
Install node-gyp using:
sudo npm install -g node-gyp
Note: To build with node-gyp the configuration file binding.gyp
is required.
Example:
{
"targets": [
{
"target_name": "binding",
"sources": [ "src/binding.cc" ]
}
]
}
It's actually rbytes that's causing the issue.
To make it even more complex: rbytes
isn't a direct dependency for shoe
, but for sockjs
. And looking at the code, that should function without rbytes
too.
Since shoe declares is as an optional dependency, shoe
does get installed:
npm WARN optional dep failed, continuing rbytes@0.0.2
^^^^^^^^ ^^^^^^^^^^
So you should just be able to use it regardless of the warning.
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.
My fork is at https://github.com/eddydas/node-sleep
To get it work, first make sure you have node-gyp by
$ 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.
$ 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!
I simply upgraded my node version (from 0.4.4 into 0.6.2), problem was resolved.