Error while trying to install nodejs pm2 module - node.js

I'm trying to install pm2 module, but I'm facing this error. OS is Ubuntu 14.04 Beta2.
Node.js version is 0.10.25, npm - 1.4.7.
What am I doing wrong?
halkar#halkar-nb-ubuntu:~/source$ sudo npm install pm2 -g
.......
npm http 304 https://registry.npmjs.org/fsevents
npm http 304 https://registry.npmjs.org/bindings
npm http 304 https://registry.npmjs.org/recursive-readdir
npm http 304 https://registry.npmjs.org/configurable
npm WARN optional dep failed, continuing fsevents#0.2.0
> usage#0.3.9 install /usr/lib/node_modules/pm2/node_modules/usage
> 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/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 3.13.0-19-generic
gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/lib/node_modules/pm2/node_modules/usage
gyp ERR! node -v v0.10.25
gyp ERR! node-gyp -v v0.13.0
gyp ERR! not ok
npm http 304 https://registry.npmjs.org/escape-regexp
npm http 304 https://registry.npmjs.org/keypress
npm http 304 https://registry.npmjs.org/mkdirp
npm ERR! usage#0.3.9 install: `node-gyp rebuild`
npm ERR! Exit status 1

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

Related

npm install bcrypt retuns error code 127

i am trying to install bcrypt using npm install however i get the following error:
npm http GET https://registry.npmjs.org/bcrypt
npm http 304 https://registry.npmjs.org/bcrypt
npm http GET https://registry.npmjs.org/bindings/1.0.0
npm http GET https://registry.npmjs.org/nan/1.5.0
npm http 304 https://registry.npmjs.org/nan/1.5.0
npm http 304 https://registry.npmjs.org/bindings/1.0.0
> bcrypt#0.8.1 install /var/www/learningbankapi/src/node_modules/bcrypt
> node-gyp rebuild
/bin/sh: 1: node: not found
gyp: Call to 'node -e "require('nan')"' 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: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.16.0-31-generic
gyp ERR! command "nodejs" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /var/www/learningbankapi/src/node_modules/bcrypt
gyp ERR! node -v v0.10.25
gyp ERR! node-gyp -v v0.10.10
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! weird error 1
npm ERR! not ok code 0
Have anyone experienced the same or know how i might fix it?

Contextify install fails - "node: not found"

I cannot get Contextify to install on my system. I am running Ubuntu 14.04, node.js version 0.10.25, npm version 1.3.10, with node-gyp version 0.10.10
I've tried upgrading, restarting, installing dependencies first, everything. Nothing will get it to work.
~$ sudo npm install -g contextify
npm http GET https://registry.npmjs.org/contextify
npm http 304 https://registry.npmjs.org/contextify
npm http GET https://registry.npmjs.org/bindings
npm http GET https://registry.npmjs.org/nan
npm http 304 https://registry.npmjs.org/bindings
npm http 304 https://registry.npmjs.org/nan
> contextify#0.1.8 install /usr/local/lib/node_modules/contextify
> node-gyp rebuild
/bin/sh: 1: node: not found
gyp: Call to 'node -e "require('nan')"' 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: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.13.0-29-generic
gyp ERR! command "nodejs" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/contextify
gyp ERR! node -v v0.10.25
gyp ERR! node-gyp -v v0.10.10
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! weird error 1
npm ERR! not ok code 0
I had the same problem. Apparently Debian has renamed the command node to nodejs which is causing the problem. For me installing nodejs-legacy fixed the issue.
sudo apt-get update && sudo apt-get install nodejs-legacy
See https://github.com/voodootikigod/node-serialport/issues/301 for details.

Error installing zmq Node Module

When installing the zmq node module, I get the following error.
I have the latest stable version of node installed.
I am running a Mac on OS X 10.9.3
npm http GET https://registry.npmjs.org/zmq
npm http 304 https://registry.npmjs.org/zmq
npm http GET https://registry.npmjs.org/nan
npm http GET https://registry.npmjs.org/bindings
npm http 304 https://registry.npmjs.org/nan
npm http 304 https://registry.npmjs.org/bindings
> zmq#2.7.0 install /Users/mario/node_modules/zmq
> node-gyp rebuild
/bin/sh: pkg-config: command not found
gyp: Call to 'pkg-config libzmq --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/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:340:16)
gyp ERR! stack at ChildProcess.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:809:12)
gyp ERR! System Darwin 13.2.0
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/mario/node_modules/zmq
gyp ERR! node -v v0.10.29
gyp ERR! node-gyp -v v0.13.0
gyp ERR! not ok
npm ERR! zmq#2.7.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the zmq#2.7.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 Darwin 13.2.0
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "zmq"
npm ERR! cwd /Users/mario/messaging
npm ERR! node -v v0.10.29
npm ERR! npm -v 1.4.9
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/mario/messaging/npm-debug.log
npm ERR! not ok code 0
Why do I get this error and what should I do to fix it?
Looks like you need to install pkg-config:
/bin/sh: pkg-config: command not found
Try brew install pkg-config

npm issue CERT_NOT_YET_VALID on raspberry pi

Can't get raspberry pi to npm install anything!
pi#raspberrypi ~/raspi-helloworld $ npm install serialport
npm WARN package.json raspi-helloworld#0.0.0 No README.md file found!
npm http GET http://registry.npmjs.org/serialport
npm http 304 http://registry.npmjs.org/serialport
npm http GET http://registry.npmjs.org/sf/0.1.6
npm http GET http://registry.npmjs.org/optimist
npm http GET http://registry.npmjs.org/nan
npm http GET http://registry.npmjs.org/node-pre-gyp
npm http GET http://registry.npmjs.org/bindings/1.1.1
npm http GET http://registry.npmjs.org/async/0.1.18
npm http 304 http://registry.npmjs.org/optimist
npm http 304 http://registry.npmjs.org/nan
npm http 304 http://registry.npmjs.org/async/0.1.18
npm http 304 http://registry.npmjs.org/sf/0.1.6
npm http 304 http://registry.npmjs.org/bindings/1.1.1
npm http 304 http://registry.npmjs.org/node-pre-gyp
npm http GET http://registry.npmjs.org/wordwrap
npm http 304 http://registry.npmjs.org/wordwrap
> serialport#1.4.0 install /home/pi/raspi-helloworld/node_modules/serialport
> node-pre-gyp install --fallback-to-build
node-pre-gyp http GET https://node-serialport.s3.amazonaws.com/serialport/v1.4.0/Release/v8-3.14-linux-arm.tar.gz
node-pre-gyp http CERT_NOT_YET_VALID (falling back to source compile with node-gyp)
make: Entering directory `/home/pi/raspi-helloworld/node_modules/serialport/build'
make: Warning: File `../binding.gyp' has modification time 7.1e+05 s in the future
ACTION Regenerating Makefile
gyp: binding.gyp not found (cwd: /home/pi/raspi-helloworld/node_modules/serialport/build) while trying to load binding.gyp
make: *** [Makefile] Error 1
make: Leaving directory `/home/pi/raspi-helloworld/node_modules/serialport/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/home/pi/projects/node-v0.10.2-linux-arm-pi/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:757:12)
gyp ERR! System Linux 3.6.11+
gyp ERR! command "/home/pi/projects/node-v0.10.2-linux-arm-pi/bin/node" "/home/pi/projects/node-v0.10.2-linux-arm-pi/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--name=serialport" "--configuration=Release" "--module_name=serialport" "--version=1.4.0" "--major=1" "--minor=4" "--runtime=node" "--node_abi=v8-3.14" "--platform=linux" "--arch=arm" "--target_arch=arm" "--module_main=./serialport" "--host=https://node-serialport.s3.amazonaws.com/" "--module_path=/home/pi/raspi-helloworld/node_modules/serialport/build/serialport/v1.4.0/Release/v8-3.14-linux-arm" "--remote_path=./serialport/v1.4.0/Release/" "--package_name=v8-3.14-linux-arm.tar.gz" "--staged_tarball=build/stage/serialport/v1.4.0/Release/v8-3.14-linux-arm.tar.gz" "--hosted_path=https://node-serialport.s3.amazonaws.com/serialport/v1.4.0/Release/" "--hosted_tarball=https://node-serialport.s3.amazonaws.com/serialport/v1.4.0/Release/v8-3.14-linux-arm.tar.gz"
gyp ERR! cwd /home/pi/raspi-helloworld/node_modules/serialport
gyp ERR! node -v v0.10.2
gyp ERR! node-gyp -v v0.9.3
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/home/pi/projects/node-v0.10.2-linux-arm-pi/bin/node rebuild --name=serialport --configuration=Release --module_name=serialport --version=1.4.0 --major=1 --minor=4 --runtime=node --node_abi=v8-3.14 --platform=linux --arch=arm --target_arch=arm --module_main=./serialport --host=https://node-serialport.s3.amazonaws.com/ --module_path=/home/pi/raspi-helloworld/node_modules/serialport/build/serialport/v1.4.0/Release/v8-3.14-linux-arm --remote_path=./serialport/v1.4.0/Release/ --package_name=v8-3.14-linux-arm.tar.gz --staged_tarball=build/stage/serialport/v1.4.0/Release/v8-3.14-linux-arm.tar.gz --hosted_path=https://node-serialport.s3.amazonaws.com/serialport/v1.4.0/Release/ --hosted_tarball=https://node-serialport.s3.amazonaws.com/serialport/v1.4.0/Release/v8-3.14-linux-arm.tar.gz' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/home/pi/raspi-helloworld/node_modules/serialport/node_modules/node-pre-gyp/lib/util/compile.js:76:29)
node-pre-gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
node-pre-gyp ERR! stack at maybeClose (child_process.js:703:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:770:5)
node-pre-gyp ERR! System Linux 3.6.11+
node-pre-gyp ERR! command "node" "/home/pi/raspi-helloworld/node_modules/serialport/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/pi/raspi-helloworld/node_modules/serialport
node-pre-gyp ERR! node -v v0.10.2
node-pre-gyp ERR! node-pre-gyp -v v0.5.11
node-pre-gyp ERR! not ok
npm ERR! serialport#1.4.0 install: `node-pre-gyp install --fallback-to-build`
npm ERR! `sh "-c" "node-pre-gyp install --fallback-to-build"` failed with 1
npm ERR!
npm ERR! Failed at the serialport#1.4.0 install script.
npm ERR! This is most likely a problem with the serialport package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-pre-gyp install --fallback-to-build
npm ERR! You can get their info via:
npm ERR! npm owner ls serialport
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.6.11+
npm ERR! command "/home/pi/projects/node-v0.10.2-linux-arm-pi/bin/node" "/home/pi/projects/node-v0.10.2-linux-arm-pi/bin/npm" "install" "serialport"
npm ERR! cwd /home/pi/raspi-helloworld
npm ERR! node -v v0.10.2
npm ERR! npm -v 1.2.15
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/pi/raspi-helloworld/npm-debug.log
npm ERR! not ok code 0
As the commenters have suggested, the first thing to check is that you have the correct system time -- or at least an incorrect time that falls within the range your certificate professes ;-)
The error code is nodejs error, not raspberry per se. It refers to invalid ssl certificate. This solution worked for me.
$ npm config set strict-ssl false
$ npm config set unsafe-perm true
$ npm config set registry http://registry.npmjs.org/
I had this error in Ubuntu WSL2 on Windows10.
A restart of my PC solved the issue.
Had this error👇
npm ERR! code CERT_NOT_YET_VALID
npm ERR! errno CERT_NOT_YET_VALID
npm ERR! request to https://registry.npmjs.org/helmet failed, reason: certificate is not yet valid
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\USER\AppData\Local\npm-cache_logs\2021-07-08T18_40_13_221Z-debug.log
Updating my system time worked.

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.

Resources