Trying to understand `npm` install errors - node.js

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...

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?

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

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

Related

Ubuntu/ Huge Error while installing npm modules

Node: 12.6.0,
Npm:6.10.1,
Ubuntu: 19.04
I got this huge error when I run
npm i <package-name> Error Link https://textsaver.flap.tv/lists/2s4g
When I include sudo sudo i <package-name> I got this error
usama#usama:~/Learn/back-end/advance-nodejs/section two$ sudo npm i webworker-threads
> webworker-threads#0.7.17 install /home/usama/Learn/back-end/advance-nodejs/section two/node_modules/webworker-threads
> node-gyp rebuild
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/home/usama/Learn/back-end/advance-nodejs/section two/node_modules/webworker-threads/build'
gyp ERR! System Linux 5.0.0-20-generic
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/usama/Learn/back-end/advance-nodejs/section two/node_modules/webworker-threads
gyp ERR! node -v v12.6.0
gyp ERR! node-gyp -v v5.0.2
gyp ERR! not ok
npm WARN section-two#1.0.0 No description
npm WARN section-two#1.0.0 No repository field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! webworker-threads#0.7.17 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the webworker-threads#0.7.17 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/usama/.npm/_logs/2019-07-13T15_25_15_922Z-debug.log
usama#usama:~/Learn/back-end/advance-nodejs/section two$
Using yarn instead of npm solve the issue.

Error installing a npm module (printer) on linux

I am trying to install a printer module for node on a lubuntu system, but making the npm installation, I get this:
gyp: Call to 'cups-config --libs' returned exit status 127. 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:344: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.16.0-23-generic
gyp ERR! command "nodejs" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /home/puesto1/app/node_modules/printer
gyp ERR! node -v v0.10.25
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian
npm ERR! printer#0.1.1 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the printer#0.1.1 install script.
npm ERR! This is most likely a problem with the printer 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 printer
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.16.0-23-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! cwd /home/puesto1/app
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.4.21
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/puesto1/app/npm-debug.log
npm ERR! not ok code 0
It is a recently installed lubuntu, and I donĀ“t know what to do. Any suggestion to solve the problem?? Any other module to print??
Thank you.
I think node-gyp is not up to date in your system and also cups-config is not installed, try to re-install node-gyp using apt-get with this command : sudo apt-get install node-gyp and install cups-config using command : sudo apt-get install libcups2-dev

Install ctags from npm: no such option --no-parallel

I recently installed node and npm to try it out but during an installation of a module it stuck on the ctags package which it depended on. Trying to only install ctags resulted in a weird error which I could not find a solution for.
henje#mymachine:~/test/node-ctags$ npm install
npm http GET https://registry.npmjs.org/grunt
npm http GET https://registry.npmjs.org/nan/0.8.0
npm http GET https://registry.npmjs.org/bindings
npm http GET https://registry.npmjs.org/grunt-contrib-coffee
npm http GET https://registry.npmjs.org/event-stream
npm http GET https://registry.npmjs.org/grunt-shell
npm http GET https://registry.npmjs.org/node-gyp
[...]
> ctags#0.11.0 install /home/henje/test/node-ctags
> node-gyp rebuild
Usage: gyp_main.py [options ...] [build_file ...]
gyp_main.py: error: no such option: --no-parallel
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 2
gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:340: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 2.6.36.4-vs2.3.0.36.39-nc
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/henje/test/node-ctags
gyp ERR! node -v v0.10.26
gyp ERR! node-gyp -v v0.13.0
gyp ERR! not ok
npm ERR! ctags#0.11.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ctags#0.11.0 install script.
npm ERR! This is most likely a problem with the ctags 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 ctags
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 2.6.36.4-vs2.3.0.36.39-nc
npm ERR! command "node" "/usr/local/bin/npm" "install"
npm ERR! cwd /home/henje/test/node-ctags
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.6
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/henje/test/node-ctags/npm-debug.log
npm ERR! not ok code 0
I am not sure if this is a general issue or just. I tried npm install ctags as well as cloning from github. I also checked if I have a recent gcc, etc. for gyp and have no idea left. I appreciate any answers.
I have also faced this issue while trying to install pm2 module.
As a workaround, removing gyp solved this problem for me:
sudo apt-get remove gyp
Here is the issue itself listed in pm2 repository: https://github.com/Unitech/pm2/issues/434

node-expat install error on ubuntu VM

I could not find anything yet in order to solve my issues, ive read all google and still no anwer, did anyone had issues installing this package and could solve it? I need help with this.
ubuntu#ubuntu:~/Desktop/nodeEjabberd$ npm cache clean
ubuntu#ubuntu:~/Desktop/nodeEjabberd$ sudo npm install node-expat
npm http GET https://registry.npmjs.org/node-expat
npm http 200 https://registry.npmjs.org/node-expat
npm http GET https://registry.npmjs.org/node-expat/-/node-expat-2.1.4.tgz
npm http 200 https://registry.npmjs.org/node-expat/-/node-expat-2.1.4.tgz
npm http GET https://registry.npmjs.org/nan
npm http 200 https://registry.npmjs.org/nan
npm http GET https://registry.npmjs.org/nan/-/nan-0.6.0.tgz
npm http 200 https://registry.npmjs.org/nan/-/nan-0.6.0.tgz
> node-expat#2.1.4 install /home/ubuntu/Desktop/nodeEjabberd/node_modules/node-expat
> node-gyp rebuild
gyp: /home/ubuntu/.node-gyp/0.10.24/common.gypi not found (cwd: /home/ubuntu/Desktop/nodeEjabberd/node_modules/node-expat) while reading includes of binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:337:16)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:789:12)
gyp ERR! System Linux 3.5.0-45-generic
gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/ubuntu/Desktop/nodeEjabberd/node_modules/node-expat
gyp ERR! node -v v0.10.24
gyp ERR! node-gyp -v v0.12.1
gyp ERR! not ok
npm ERR! node-expat#2.1.4 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-expat#2.1.4 install script.
npm ERR! This is most likely a problem with the node-expat 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 node-expat
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.5.0-45-generic
npm ERR! command "node" "/usr/bin/npm" "install" "node-expat"
npm ERR! cwd /home/ubuntu/Desktop/nodeEjabberd
npm ERR! node -v v0.10.24
npm ERR! npm -v 1.3.23
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/ubuntu/Desktop/nodeEjabberd/npm-debug.log
npm ERR! not ok code 0
'.node-gyp/0.10.24/common.gypi not found' suggests that something went wrong when node-gyp tried to install headers of nodejs 0.10.24.
Delete /home/ubuntu/.node-gyp directory and try again.

zeromq.node installation error Ubuntu 12.04: ' node-gyp rebuild'

I'm trying to install zeromq.node using:
$ npm install zmq
However, I keep getting the error below. Any help would be much appreciated.
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/share/npm/node_modules/node-gyp/lib/build.js:215:23)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:91:17)
gyp ERR! stack at Process._handle.onexit (child_process.js:674:10)
gyp ERR! System Linux 3.2.0-29-generic
gyp ERR! command "node" "/usr/share/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/robot/code/game/node_modules/zmq
gyp ERR! node -v v0.8.6
gyp ERR! node-gyp -v v0.6.3
gyp ERR! not ok
npm ERR! zmq#2.1.0 install: `node-gyp rebuild`
npm ERR! `sh "-c" "node-gyp rebuild"` failed with 1
npm ERR!
npm ERR! Failed at the zmq#2.1.0 install script.
npm ERR! This is most likely a problem with the zmq 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 zmq
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.2.0-29-generic
npm ERR! command "nodejs" "/usr/bin/npm" "install" "zmq"
npm ERR! cwd /home/robot/code/game/test/amqp
npm ERR! node -v v0.8.6
npm ERR! npm -v 1.1.48
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/robot/code/game/test/amqp/npm-debug.log
npm ERR! not ok code 0
gyp bulid error removed libzmq dev and its dependencies and tried below steps..it worked for me
$ sudo apt-get update
$ sudo apt-get install build-essential
$ sudo apt-get install libzmq-dev
$ npm install zmq
I managed to solve this by following this tutorial for installing the python-client. After completing each of the steps I found I was then able to install the node.zeromq module through npm using:
$ npm install zmq
I'm guessing this is due to missing some of the required files. Most likely libzmq-dev.

Resources