nodegit: Installing nodegit via npm fails at Configuring libssh2.
When I try installing nodegit via npm it keeps throwing the following error. I tried the following:
brew reinstall gcc
- I tried reinstalling node via brew and also via the node installer
sudo xcode-select --install
Is there anything else I can do? - Having the same issue even on other machines, all running MacOS Sierra.
My Node Version is: v6.11.2 My NPM Version is: 3.10.10
Console Output after npm install nodegit
:
[nodegit] Running pre-install script
[nodegit] Configuring libssh2.
{ Error: spawn /bin/sh ENOENT
at exports._errnoException (util.js:1020:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
at onErrorNT (internal/child_process.js:367:16)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickCallback (internal/process/next_tick.js:104:9)
code: 'ENOENT',
errno: 'ENOENT',
syscall: 'spawn /bin/sh',
path: '/bin/sh',
spawnargs:
[ '-c',
'/Users/timeoschmidt/Desktop/Freiheit\\ Praktikum/Node\\ Upload\\ Repo/node_modules/nodegit/vendor/libssh2/configure --with-libssl-prefix=/Users/timeoschmidt/Desktop/Freiheit\\ Praktikum/Node\\ Upload\\ Repo/node_modules/nodegit/vendor/openssl/openssl' ],
cmd: '/Users/timeoschmidt/Desktop/Freiheit\\ Praktikum/Node\\ Upload\\ Repo/node_modules/nodegit/vendor/libssh2/configure --with-libssl-prefix=/Users/timeoschmidt/Desktop/Freiheit\\ Praktikum/Node\\ Upload\\ Repo/node_modules/nodegit/vendor/openssl/openssl' }
[nodegit] ERROR - Could not finish preinstall
{ Error: spawn /bin/sh ENOENT
at exports._errnoException (util.js:1020:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
at onErrorNT (internal/child_process.js:367:16)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickCallback (internal/process/next_tick.js:104:9)
code: 'ENOENT',
errno: 'ENOENT',
syscall: 'spawn /bin/sh',
path: '/bin/sh',
spawnargs:
[ '-c',
'/Users/timeoschmidt/Desktop/Freiheit\\ Praktikum/Node\\ Upload\\ Repo/node_modules/nodegit/vendor/libssh2/configure --with-libssl-prefix=/Users/timeoschmidt/Desktop/Freiheit\\ Praktikum/Node\\ Upload\\ Repo/node_modules/nodegit/vendor/openssl/openssl' ],
cmd: '/Users/timeoschmidt/Desktop/Freiheit\\ Praktikum/Node\\ Upload\\ Repo/node_modules/nodegit/vendor/libssh2/configure --with-libssl-prefix=/Users/timeoschmidt/Desktop/Freiheit\\ Praktikum/Node\\ Upload\\ Repo/node_modules/nodegit/vendor/openssl/openssl' }
npm ERR! Darwin 16.7.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "nodegit"
npm ERR! node v6.11.2
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! nodegit@0.18.3 install: `node lifecycleScripts/preinstall && node lifecycleScripts/install`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the nodegit@0.18.3 install script 'node lifecycleScripts/preinstall && node lifecycleScripts/install'.
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 nodegit package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node lifecycleScripts/preinstall && node lifecycleScripts/install
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs nodegit
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls nodegit
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/timeoschmidt/Desktop/Freiheit Praktikum/Node Upload Repo/npm-debug.log
( If I am running the same command with global -g argument, it seems to install without errors, but my scripts using nodegit still throw the error: Error: Cannot find module 'nodegit'
).
I would really appreciate help or references to other issues with things I can try.
About this issue
- Original URL
- State: open
- Created 7 years ago
- Reactions: 15
- Comments: 26 (3 by maintainers)
After some debugging I’ve figured out that the problem occurs if there’s space in the cwd path.
@timeo-schmidt: /Users/timeoschmidt/Desktop/Freiheit Praktikum/Node Upload Repo/(…) @MartinMuzatko: /mnt/c/Users/Martin Muzatko/(…)
So I think the escaping here maybe not perfect. Perhaps releated to nodejs/node#5060.
/cc @rcjsuen
no. Doing --save does not fix it for me. I still get the following error. To me it looks actually, like vendor/libssh2 was not downloaded and can’t be executed.
For some reason running
npm install nodegit --save
worked… ( --save made the difference…it might be that you have to try out the stuff above in my question in combination with that however… gl)sudo xcode-select --install
does not fix this any more on macOS Mojaveupd1: actually upgrading from Sierra to Mojave breaks nodegit. upd2:
brew install libgcrypt
fixes this issue on Mojave thoughI’m done with this shit. I will just use docker to deliver the environment nodegit needs. That nobody took the time and fixed the script by escaping the path shows me how less the team cares about cross-platform adaptability.
I’m not the best with bash either, but this should suffice: https://apple.stackexchange.com/a/52485
This is what I got after running
npm install
inside a project that usesnodegit
@biohazard999 try to run
brew doctor
it will tell you issues and possible solutions. Do you havenpm
-related permission issues? If so, it will also break nodegit. I meansudo npm install nodegit
will not work. It will work only withoutsudo
. If so, try this guide to fix npm permissions@ThiagoDallacqua Try
sudo apt-get install libssl-dev libcurl4-openssl-dev
.If not, you could also try
sudo apt-get install curl libcurl3
.brew install libgcrypt
was the fix for meRunning: macOS Sierra
Ran
brew doctor
and got a warning saying to update xcode command line tools. Worked after updating.