1

I am new to node. Can someone please tell me why this is failing?

sudo su
nvm use 0.10
git clone https://github.com/bitpay/insight.git && cd insight
npm install

...output omitted...

> leveldown@0.10.2 install /insight/node_modules/insight-bitcore-api/node_modules/leveldown
> node-gyp rebuild

gyp: Call to 'node -e "require('nan')"' returned exit status 1. while trying to load binding.gyp
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/share/node-gyp/lib/configure.js:431:16)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Linux 3.11.0-19-generic
gyp ERR! command "nodejs" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /insight/node_modules/insight-bitcore-api/node_modules/leveldown
gyp ERR! node -v v0.10.25
gyp ERR! node-gyp -v v0.10.10
gyp ERR! not ok 

...

npm ERR! Error: ENOENT, lstat '/insight/node_modules/insight-bitcore-api/node_modules/bitcore/node_modules/browserify/node_modules/crypto-browserify/test/vectors/byte0002.dat'
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     <http://github.com/npm/npm/issues>

npm ERR! System Linux 3.11.0-19-generic
npm ERR! command "/root/.nvm/v0.10.26/bin/node" "/root/.nvm/v0.10.26/bin/npm" "install"
npm ERR! cwd /insight
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.3
npm ERR! path /insight/node_modules/insight-bitcore-api/node_modules/bitcore/node_modules/browserify/node_modules/crypto-browserify/test/vectors/byte0002.dat
npm ERR! fstream_path /insight/node_modules/insight-bitcore-api/node_modules/bitcore/node_modules/browserify/node_modules/crypto-browserify/test/vectors/byte0002.dat
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /root/.nvm/v0.10.26/lib/node_modules/npm/node_modules/fstream/lib/writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR! error rolling back Error: ENOTEMPTY, rmdir '/insight/node_modules/insight-bitcore-api/node_modules/bitcore/node_modules/browserify/node_modules/timers-browserify/node_modules/process'
npm ERR! error rolling back  insight-bitcore-api@0.1.9 { [Error: ENOTEMPTY, rmdir '/insight/node_modules/insight-bitcore-api/node_modules/bitcore/node_modules/browserify/node_modules/timers-browserify/node_modules/process']
npm ERR! error rolling back   errno: 53,
npm ERR! error rolling back   code: 'ENOTEMPTY',
npm ERR! error rolling back   path: '/insight/node_modules/insight-bitcore-api/node_modules/bitcore/node_modules/browserify/node_modules/timers-browserify/node_modules/process' }
npm ERR! leveldown@0.10.2 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the leveldown@0.10.2 install script.
npm ERR! This is most likely a problem with the leveldown package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls leveldown
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 3.11.0-19-generic
npm ERR! command "/root/.nvm/v0.10.26/bin/node" "/root/.nvm/v0.10.26/bin/npm" "install"
npm ERR! cwd /insight
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.3
npm ERR! code ELIFECYCLE

Any insight into this is appreciated! I'm only listing the first ERR blocks...

jcalfee314
  • 4,642
  • 8
  • 43
  • 75

3 Answers3

3

This line:

/bin/sh: 1: node: not found

leads me to believe node isn't properly installed.. What happens when you type 'node' on a command line?

XeroxDucati
  • 5,130
  • 2
  • 37
  • 66
  • 1
    This particular error was that node was not accessible only when using `sudo`. This is entirely possible depending on how node was installed. – mscdex Apr 22 '14 at 18:33
  • `apt-get install node` did take care of this error. I'm upvoting this answer, thank you. Unfortunately, this still leaves the next error: `gyp: Call to 'node -e "require('nan')"' returned exit status 1`. I have updated the error above (although it looks like nothing else changed). – jcalfee314 Apr 22 '14 at 19:26
  • The require 'nan' error may be related to the npm version: https://github.com/bitpay/insight/issues/461 – jcalfee314 Apr 22 '14 at 19:40
  • I have had much better luck with various node apps by using Ubuntu 14.04 LTS instead of 12.04 LTS. I used Lxc to figure this out. I often use the lxc to work in just making the files public to my host. – jcalfee314 Jul 25 '14 at 17:51
3

You need to have nodejs to be accessible with node in the command line.

But: In the Ubuntu repos there is a confusion/conflict between nodejs and ax25-node, the latter occupying the /usr/bin/node path. When you never installed node aka ax25-node you can simply

sudo aptitude install nodejs-legacy

This installs nodejs and creates a symbolic link to /usr/bin/node.

Now npm installs run without any error messages.

In my case the same error as yours appeared when trying to

npm install -g Haraka

The solution is from a fairly unrelated stackoverflow post: nodejs vs node on ubuntu 12.04

Community
  • 1
  • 1
1

I ran npm install node (even though it was already installed to some degree) and the issue was resolved.