trying to 'npm install', getting node-gyp rebuild errors
ernestscomputer:musicomp ernest son$ npm install
> [email protected] install /Users/ernest son/Desktop/PROJECTS/musicomp/node_modules/bufferutil
> node-gyp rebuild
CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
clang: error: no such file or directory: 'son/.node-gyp/5.0.0/include/node'
clang: error: no such file or directory: 'son/.node-gyp/5.0.0/src'
clang: error: no such file or directory: 'son/.node-gyp/5.0.0/deps/uv/include'
clang: error: no such file or directory: 'son/.node-gyp/5.0.0/deps/v8/include'
make: *** [Release/obj.target/bufferutil/src/bufferutil.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:270:23)
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 14.5.0
gyp ERR! command "/usr/local/Cellar/node/5.0.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/ernest son/Desktop/PROJECTS/musicomp/node_modules/bufferutil
gyp ERR! node -v v5.0.0
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm WARN install:[email protected] [email protected] install: `node-gyp rebuild`
npm WARN install:[email protected] Exit status 1
> [email protected] install /Users/ernest son/Desktop/PROJECTS/musicomp/node_modules/utf-8-validate
> node-gyp rebuild
CXX(target) Release/obj.target/validation/src/validation.o
clang: error: no such file or directory: 'son/.node-gyp/5.0.0/include/node'
clang: error: no such file or directory: 'son/.node-gyp/5.0.0/src'
clang: error: no such file or directory: 'son/.node-gyp/5.0.0/deps/uv/include'
clang: error: no such file or directory: 'son/.node-gyp/5.0.0/deps/v8/include'
make: *** [Release/obj.target/validation/src/validation.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:270:23)
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 14.5.0
gyp ERR! command "/usr/local/Cellar/node/5.0.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/ernest son/Desktop/PROJECTS/musicomp/node_modules/utf-8-validate
gyp ERR! node -v v5.0.0
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm WARN install:[email protected] [email protected] install: `node-gyp rebuild`
npm WARN install:[email protected] Exit status 1
@gibfahn: Package python has already been installed.
Might be a WSL specific issue, cc/ @refack @nodejs/platform-windows
Hello guys,
It seems a long discussion and with several solutions. I did try all the above and nothing worked, so I did decide to simply uninstall node-gyp for now. This finally worked. I can understand that this is not a final solution but it was stopping me really to install any package so I did uninstall it as a workaround. So a simple:
sudo npm uninstall -g node-gyp
Should work! I hope I will help someone desperately searching for unblocking his workflow and constantly having the node-gyp rebuild error.
Cheers Johnny
Error: Can't find Python executable "C:Python27python.exe", you can set the PYTHON env variable.
Might be a WSL specific issue, cc/ @refack @nodejs/platform-windows
Yes this looks like WSL problem — @strarsis is it possible you are running the win32 node.exe binary? (what does which node or which npm show).
If that is the case, try installing node with nvm as if you are on native Ubuntu.
If it's not you can try setting the PYTHON env var to the posix path of python2 ($(which python2))
@refack: In WSL:
$ which node
/home/<user>/.nvm/versions/node/v6.11.3/bin/node
$ which npm
/home/<user>/.nvm/versions/node/v6.11.3/bin/npm
$ which python3
/usr/bin/python3
node-gyp depends on python2
@refack:
$ which python
/usr/bin/python
$ python
Python 2.7.12 [...]
does this help:
export PYTHON=/usr/bin/python
yarn install ...
P.S. I forgot you mentioned you are using yarn. What does which yarn give?
@refack:
$ which yarn
/usr/bin/yarn
@refack: I set the PYTHON environment variable but I get this error:
[...]
gyp ERR! stack Error: Can't find Python executable "C:Python27python.exe", you can set the PYTHON env variable.
[...]
I set the PYTHON environment variable but I get this error:
[...] gyp ERR! stack Error: Can't find Python executable "C:Python27python.exe", you can set the PYTHON env variable. [...]
I'm trying to reproduce this locally...
@refack: Still encountered this issue with a different package (ttf2woff2). Are there any workarounds?
@strarsis check if https://github.com/nodejs/node-gyp/issues/1320 help
that is check in a cmd window (run set) if your windows environment export a PYTHON or PYTHONPATH env var to the WSL session
the same problem occur with me i solve it with first step 1_ install python 2.7 2_ i added new path to environoment install with python 2.7 location
After switching to a new NodeJS version using n I got this issue as well (I usually do when switching versions...)
This did the trick for me:
npm explore npm -g -- npm install node-gyp@latest
I was missing g++, this fixed it for me
sudo yum install gcc gcc-c++
If anyone is still having issues, I was able to solve this (CentOS 7) with
sudo yum install g++
and
sudo yum install libpcap-dev (I might be forgetting the exact equivalent for libpcap-dev but I think that is right.)
After these were set up, I destroyed the node-modules folder created by npm install
and reinstalled npm install pcap2. pcap still failed but pcap2 is essentially the same thing from what I've seen on the docs so far.
This worked for me: (Ubuntu)
sudo apt install libavahi-compat-libdnssd-dev
Hi. I have tryed all recepts above. But can't npm update without error.
multihashing.target.mk:144: ошибка выполнения рецепта для цели «Release/obj.target/multihashing/multihashing.o»
make: *** [Release/obj.target/multihashing/multihashing.o] Ошибка 1
make: выход из каталога «/home/root2pool/nomp/node_modules/multi-hashing/build»
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/home/root2pool/nomp/node_modules/node-gyp/lib/build.js:258:23)
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 Linux 4.10.0-40-generic
gyp ERR! command "/usr/bin/nodejs" "/home/root2pool/nomp/node_modules/.bin/node-gyp" "rebuild"
gyp ERR! cwd /home/root2pool/nomp/node_modules/multi-hashing
gyp ERR! node -v v4.2.6
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
[email protected] /home/root2pool/nomp
└── [email protected] extraneous
npm ERR! Linux 4.10.0-40-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "update"
npm ERR! node v4.2.6
npm ERR! npm v3.5.2
npm ERR! code ELIFECYCLE
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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 multi-hashing 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 multi-hashing
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls multi-hashing
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/root2pool/nomp/npm-debug.log