This question already has answers here:
Cannot install packages using node package manager in Ubuntu
(19 answers)
Closed 2 years ago.
I am having problems installing an npm package called "bcrypt" on my Ubuntu system.
This is what I did:
sudo apt-get update
sudo apt-get install nodejs
sudo apt-get install npm
sudo npm install bcrypt
This is what I got:
when typing: sudo npm install bcrypt
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.3.0
npm http 304 https://registry.npmjs.org/nan/1.3.0
npm http 304 https://registry.npmjs.org/bindings/1.0.0
> bcrypt#0.8.0 install /home/gatsu/salongapp/salongapp/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.13.0-35-generic
gyp ERR! command "nodejs" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /home/gatsu/salongapp/salongapp/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
The package does not get placed in this folder:
/home/gatsu/salongapp/salongapp/node_modules/bcrypt
Any thoughts?
in ubuntu if you install nodejs using apt, the command for nodejs will be nodejs while commonly command line name used for nodejs is node.
Here, bcrypt assumes the command as node which is not available.
Try setting alias for nodejs as node like this
alias node='nodejs'
and then try to install bcrypt
sudo npm install bcrypt
U can set aliases in .bash_aliases file in home folder to permanently set the alias node.
Related
I can't resolve this error !! I'm getting crazy:
Here is the error:
gyp ERR! stack Error: Can't find Python executable "/path/to/python27/python", you can set the PYTHON env variable.
gyp ERR! stack at PythonFinder.failNoPython (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node_modules/node-gyp/lib/configure.js:484:19)
gyp ERR! stack at PythonFinder.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node_modules/node-gyp/lib/configure.js:406:16)
gyp ERR! stack at F (/usr/local/lib/node_modules/npm/node_modules/which/which.js:68:16)
gyp ERR! stack at E (/usr/local/lib/node_modules/npm/node_modules/which/which.js:80:29)
gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/which/which.js:89:16
gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/isexe/index.js:42:5
gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/isexe/mode.js:8:5
gyp ERR! stack at FSReqCallback.oncomplete (fs.js:149:21)
gyp ERR! System Darwin 18.6.0
gyp ERR! command "/usr/local/Cellar/node/12.3.1/bin/node" "/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--release"
gyp ERR! cwd /Users/federicofrydman/Desktop/glamitGitHub/front-quiz/node_modules/fibers
gyp ERR! node -v v12.3.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-gyp exited with code: 1
This was suggested:
Please make sure you are using a supported platform and node version. If you
would like to compile fibers on this machine please make sure you have setup your
build environment--
Windows + OS X instructions here: https://github.com/nodejs/node-gyp
Ubuntu users please run: sudo apt-get install g++ build-essential
RHEL users please run: yum install gcc-c++ and yum groupinstall 'Development Tools'
Alpine users please run: sudo apk add python make g++
sh: nodejs: command not found
npm WARN ts-pnp#1.1.2 requires a peer of typescript#* but none is installed. You must install peer dependencies yourself.
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! fibers#3.1.1 install: `node build.js || nodejs build.js`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the fibers#3.1.1 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! /Users/federicofrydman/.npm/_logs/2019-07-02T03_47_12_405Z-debug.log
Using the following tools:
1.MOJAVE 10.14.5
2.XCODE 10.2.1
3.PYTHON 2.7
Issue seems to be with fibers#3.1.1 which is not supported in node version 12.
Fix it by removing my latest nodejs, 12.3.1, and installing the previous stable version of 11.
https://nodejs.org/download/release/v11.15.0/
I'm have error when trying to run sudo npm install in node 10, in local server its work perfect.
error:
fibers#1.0.15 install /home/tickets/www/tickets_parser/node_modules/fibers
node build.js || nodejs build.js
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/home/tickets/www/tickets_parser/node_modules/fibers/build'
gyp ERR! System Linux 4.4.0-97-generic
gyp ERR! command "/usr/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--release"
gyp ERR! cwd /home/tickets/www/tickets_parser/node_modules/fibers
gyp ERR! node -v v10.0.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
node-gyp exited with code: 1
Please make sure you are using a supported platform and node version. If you
would like to compile fibers on this machine please make sure you have setup your
build environment--
Windows + OS X instructions here: https://github.com/nodejs/node-gyp
Ubuntu users please run: sudo apt-get install g++ build-essential
Alpine users please run: sudo apk add python make g++
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/home/tickets/www/tickets_parser/node_modules/fibers/build'
gyp ERR! System Linux 4.4.0-97-generic
gyp ERR! command "/usr/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--release"
gyp ERR! cwd /home/tickets/www/tickets_parser/node_modules/fibers
gyp ERR! node -v v10.0.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
node-gyp exited with code: 1
Please make sure you are using a supported platform and node version. If you
would like to compile fibers on this machine please make sure you have setup your
build environment--
Windows + OS X instructions here: https://github.com/nodejs/node-gyp
Ubuntu users please run: sudo apt-get install g++ build-essential
Alpine users please run: sudo apk add python make g++
npm WARN tickets_parser#0.0.0 No description
npm WARN tickets_parser#0.0.0 No repository field.
npm WARN tickets_parser#0.0.0 No license field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! fibers#1.0.15 install: node build.js || nodejs build.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the fibers#1.0.15 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/tickets/.npm/_logs/2018-05-14T19_08_18_241Z-debug.log
thanks
I tried npm install zmq and I got:
make: Entering directory '/home/lucas/dir/node_modules/zmq/build'
CXX(target) Release/obj.target/zmq/binding.o
../binding.cc:28:17: fatal error: zmq.h: No such file or directory
compilation terminated.
zmq.target.mk:94: recipe for target 'Release/obj.target/zmq/binding.o' failed
make: *** [Release/obj.target/zmq/binding.o] Error 1
make: Leaving directory '/home/lucas/dir/node_modules/zmq/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack at emitTwo (events.js:106:13)
gyp ERR! stack at ChildProcess.emit (events.js:191:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Linux 4.4.0-59-generic
gyp ERR! command "/usr/bin/nodejs" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/lucas/dir/node_modules/zmq
gyp ERR! node -v v7.4.0
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
npm WARN projectName#1.0.0 No repository field.
npm ERR! Linux 4.4.0-59-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "zmq"
npm ERR! node v7.4.0
npm ERR! npm v4.0.5
npm ERR! code ELIFECYCLE
npm ERR! zmq#2.15.3 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the zmq#2.15.3 install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, 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 information on how to open an issue for this project with:
npm ERR! npm bugs zmq
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls zmq
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/lucas/dir/npm-debug.log
Here's the pastebin of that npm-debug.log:
http://pastebin.com/UGLDEWin
Does anybody have any idea of what's happening? Seems like error in the compilation or so. As you see, my nodejs is version 7.x, not an old one. And NPM is 4.x, should work, right?
Update on latest Ubuntu:
sudo apt-get install libtool pkg-config build-essential autoconf automake
sudo apt-get install libzmq3-dev
Try to:
sudo apt-get install build-essential checkinstall
then, relaunch npm install.
If it fails again, you can try to install node-gyp globally:
npm install -g node-gyp
installing on Unix/Mac:
First install pkg-config and the ZeroMQ library.
This module is compatible with ZeroMQ versions 2, 3 and 4. The installation process varies by platform, but headers are mandatory. Most Linux distributions provide these headers with -devel packages like zeromq-devel or zeromq3-devel. Homebrew for OS X provides versions 4 and 3 with packages zeromq and zeromq3, respectively. A Chris Lea PPA is available for Debian-like users who want a version newer than currently provided by their distribution
For windows
First install Visual Studio and either Node.js or io.js.
Ensure you're building zmq from a conservative location on disk, one without unusual characters or spaces, for example somewhere like: C:\sources\myproject.
Installing the ZeroMQ library is optional and not required on Windows. We recommend running npm install and node executable commands from a github for windows shell or similar environment.
https://www.npmjs.com/package/zmq
What worked for me to avoid the Error: `make` failed with exit code: 2 error after running sudo apt-get install libzmq3-dev along with making sure I had installed all of the packages from the other answers:
From the docs:
To use your system's libzmq (if it has been installed and development headers are available):
npm install zeromq#5 --zmq-external
I'm getting this error:
/bin/sh: pkg-config: command not found
gyp: Call to 'pkg-config libzmq --libs' returned exit status 127. while trying to load binding.gyp
I've tried upgrading nodejs to 5.1.0.
I've tried downgrading nodejs to 4.2.2.
I've tried completely removing nodejs manually then re-installing 4.2.2 and trying again.
I've tried the removal script here:
https://gist.github.com/brock/5b1b70590e1171c4ab54
Then re-installing each version and trying again.
I've tried downgrading to zeromq 4.0.7.
No luck.
Here's the complete error:
localhost:~ user$ npm install zmq
/
> zmq#2.14.0 install /Users/user/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:355:16)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 13.4.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/user/node_modules/zmq
gyp ERR! node -v v4.2.2
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm ERR! Darwin 13.4.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "zmq"
npm ERR! node v4.2.2
npm ERR! npm v2.14.7
npm ERR! code ELIFECYCLE
npm ERR! zmq#2.14.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the zmq#2.14.0 install script 'node-gyp rebuild'.
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! Please include the following file with any support request:
npm ERR! /Users/user/npm-debug.log
Here's what worked...
install zmq using brew : brew install zmq
export PKG_CONFIG_PATH=/usr/local/Cellar/zeromq/4.0.4/lib/pkgconfig/
sudo visudo
add the line Defaults env_keep += "PKG_CONFIG_PATH"
sudo npm install zmq
Here is how I fixed it:
Step 1:
brew install zmq
Step 2:
export PKG_CONFIG_PATH=/usr/local/Cellar/zeromq/4.2.5/lib/pkgconfig/
(Note: zeromq Version 4.2.5 in path above will need to be changed to whatever version you installed)
Step 3:
sudo visudo
and add
Defaults env_keep += "PKG_CONFIG_PATH"
Step 4:
In package.json > dependencies, add:
"zmq": "^2.15.3"
Step 5:
Run yarn or npm install
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.