nodegit / nodegit

Native Node bindings to Git.

Home Page:https://www.nodegit.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

npm install nodegit, gitkraken, CycligentGitTool all fail to install, run, on Linux Mint Cinnamon

loveencounterflow opened this issue · comments

When I try to npm install nodegit, I get (with both node v6.9.1 and v7.7.1):

npm WARN prefer global node-gyp@3.5.0 should be installed with -g

> nodegit@0.18.0 install /home/flow/temp/resolving-issue-nodegit-libcurl/node_modules/nodegit
> node lifecycleScripts/preinstall && node lifecycleScripts/install

[nodegit] Running pre-install script
[nodegit] Configuring libssh2.
{ Error: Command failed: /home/flow/temp/resolving-issue-nodegit-libcurl/node_modules/nodegit/vendor/libssh2/configure --with-libssl-prefix=/home/flow/temp/resolving-issue-nodegit-libcurl/node_modules/nodegit/vendor/openssl/openssl
/home/flow/temp/resolving-issue-nodegit-libcurl/node_modules/nodegit/vendor/libssh2/missing: Unknown `--is-lightweight' option
Try `/home/flow/temp/resolving-issue-nodegit-libcurl/node_modules/nodegit/vendor/libssh2/missing --help' for more information
configure: WARNING: 'missing' script is too old or missing
configure: error: No crypto library found!
Try --with-libssl-prefix=PATH
 or --with-libgcrypt-prefix=PATH
 or --with-wincng on Windows

    at ChildProcess.exithandler (child_process.js:206:12)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:877:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
  killed: false,
  code: 1,
  signal: null,
  cmd: '/home/flow/temp/resolving-issue-nodegit-libcurl/node_modules/nodegit/vendor/libssh2/configure --with-libssl-prefix=/home/flow/temp/resolving-issue-nodegit-libcurl/node_modules/nodegit/vendor/openssl/openssl' }
/home/flow/temp/resolving-issue-nodegit-libcurl/node_modules/nodegit/vendor/libssh2/missing: Unknown `--is-lightweight' option
Try `/home/flow/temp/resolving-issue-nodegit-libcurl/node_modules/nodegit/vendor/libssh2/missing --help' for more information
configure: WARNING: 'missing' script is too old or missing
configure: error: No crypto library found!
Try --with-libssl-prefix=PATH
 or --with-libgcrypt-prefix=PATH
 or --with-wincng on Windows

[nodegit] ERROR - Could not finish preinstall
{ Error: Command failed: /home/flow/temp/resolving-issue-nodegit-libcurl/node_modules/nodegit/vendor/libssh2/configure --with-libssl-prefix=/home/flow/temp/resolving-issue-nodegit-libcurl/node_modules/nodegit/vendor/openssl/openssl
/home/flow/temp/resolving-issue-nodegit-libcurl/node_modules/nodegit/vendor/libssh2/missing: Unknown `--is-lightweight' option
Try `/home/flow/temp/resolving-issue-nodegit-libcurl/node_modules/nodegit/vendor/libssh2/missing --help' for more information
configure: WARNING: 'missing' script is too old or missing
configure: error: No crypto library found!
Try --with-libssl-prefix=PATH
 or --with-libgcrypt-prefix=PATH
 or --with-wincng on Windows

    at ChildProcess.exithandler (child_process.js:206:12)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:877:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
  killed: false,
  code: 1,
  signal: null,
  cmd: '/home/flow/temp/resolving-issue-nodegit-libcurl/node_modules/nodegit/vendor/libssh2/configure --with-libssl-prefix=/home/flow/temp/resolving-issue-nodegit-libcurl/node_modules/nodegit/vendor/openssl/openssl' }
npm WARN resolving-issue-nodegit-libcurl@1.0.0 No description
npm WARN resolving-issue-nodegit-libcurl@1.0.0 No repository field.
npm ERR! Linux 4.4.0-62-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "--save" "nodegit"
npm ERR! node v6.9.1
npm ERR! npm  v3.10.8
npm ERR! code ELIFECYCLE

npm ERR! nodegit@0.18.0 install: `node lifecycleScripts/preinstall && node lifecycleScripts/install`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the nodegit@0.18.0 install script 'node lifecycleScripts/preinstall && node lifecycleScripts/install'.

In related news (electron/electron#8853), both gitkraken and Cycligent Git Tool refuse to run, and in both cases, nodegit being unable to load libcurl.so.4 would appear to be the point of failure:

/usr/lib ► gitkraken
Node started time: 1488472940858
libcurl.so.4: cannot open shared object file: No such file or directory
Error: libcurl.so.4: cannot open shared object file: No such file or directory
    at Error (native)
    at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:158:20)
    at Object.Module._extensions..node (module.js:568:18)
    at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:169:18)
    at Module.load (module.js:456:32)
    at tryModuleLoad (module.js:415:12)
    at Function.Module._load (module.js:407:3)
    at Module.require (module.js:466:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/share/gitkraken/resources/app.asar/node_modules/nodegit/dist/nodegit.js:11:12)
    at Module._compile (module.js:541:32)
    ...

This is on Linux Mint Cinnamon:

► uname -a && cat /etc/issue
Linux enceladus 4.4.0-62-generic #83-Ubuntu SMP Wed Jan 18 14:10:15 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
Linux Mint 18 Sarah

For the installation problem, #1247 might be related. For your libcurl.so.4 problem, #1225 might be related.

I think both are related, but none solves the issue...

electron/electron#8853 has a solution (works on Linux Mint Cinnamon):

sudo apt-get install curl libcurl3

I think the documentation should be updated.

commented

Thanks! @loveencounterflow you sure save me with this one, after installing Linux Mint I ran into the same problem.

I have this issue on Fedora26 with GitKraken

curl and libcurl were already installed & updated

curl-7.53.1-10.fc26
libcurl-7.53.1-10.fc26

To solve this on Fedora create a symbolic link with name 'libcurl-gnutls.so.4' in your lib folder, in my case:

sudo ln -s /usr/lib64/libcurl.so.4 /usr/lib64/libcurl-gnutls.so.4

make sur you have libcurl installed first of course :)

I have this issue on Fedora26 with GitKraken too.
Thank you @johnpoth for the workaround, until a real fix has been found.

Is there anyway to get this fixed? All Fedora users have to create a system level symlink to run an application that uses nodegit. I can't be having non-technical users create symlinks. That's completely unreasonable.

commented

Centos 7, same bug, @johnpoth solution with symlink works.

Manjaro same problem, symlink conflicts with existing file and forcing dont work...

Amazon Linux AMI, same bug, @johnpoth solution works!

It's really unacceptable to require users to create a system-level symlink. Can we please do something about this? The problem is that the precompiled binaries are being made on Ubuntu, which seems to be the only distribution on the planet that links to libcurl-gnutls.so.4 instead of libcurl.so.4.

Any idea why the gitkraken while it installs is unable to work properly in Linux mint 18? I make branches and I commit and when I need to checkout the master it says that I need to commit things or stash and gives a message of conflict. It looks like it does not have writing permissions to the directory. Gitcola works properly at the same tasks, but it is not as beautiful as gitkraken. Any ideas?

commented

@nasianikolaou Looks like your issue is not related to this one.

If you made a clone using GitKraken, you should be fine with file permission. Otherwise contact the GitKraken support to get some help.

Hi all,
I run Ubuntu 16.04 and I get a similar issue:

> nodegit@0.21.2 install /usr/local/lib/node_modules/@antora/site-generator-default/node_modules/nodegit
> node lifecycleScripts/preinstall && node lifecycleScripts/install

[nodegit] Running pre-install script
[nodegit] Configuring libssh2.
{ Error: Command failed: /usr/local/lib/node_modules/@antora/site-generator-default/node_modules/nodegit/vendor/libssh2/configure --with-libssl-prefix=/usr/local/lib/node_modules/@antora/site-generator-default/node_modules/nodegit/vendor/openssl/openssl
/usr/local/lib/node_modules/@antora/site-generator-default/node_modules/nodegit/vendor/libssh2/configure: line 2059: config.log: Permission denied
/usr/local/lib/node_modules/@antora/site-generator-default/node_modules/nodegit/vendor/libssh2/configure: line 2069: config.log: Permission denied

    at ChildProcess.exithandler (child_process.js:273:12)
    at ChildProcess.emit (events.js:180:13)
    at maybeClose (internal/child_process.js:936:16)
    at Socket.stream.socket.on (internal/child_process.js:353:11)
    at Socket.emit (events.js:180:13)
    at Pipe._handle.close [as _onclose] (net.js:541:12)
  killed: false,
  code: 1,
  signal: null,
  cmd: '/usr/local/lib/node_modules/@antora/site-generator-default/node_modules/nodegit/vendor/libssh2/configure --with-libssl-prefix=/usr/local/lib/node_modules/@antora/site-generator-default/node_modules/nodegit/vendor/openssl/openssl' }
/usr/local/lib/node_modules/@antora/site-generator-default/node_modules/nodegit/vendor/libssh2/configure: line 2059: config.log: Permission denied
/usr/local/lib/node_modules/@antora/site-generator-default/node_modules/nodegit/vendor/libssh2/configure: line 2069: config.log: Permission denied

[nodegit] ERROR - Could not finish preinstall
{ Error: Command failed: /usr/local/lib/node_modules/@antora/site-generator-default/node_modules/nodegit/vendor/libssh2/configure --with-libssl-prefix=/usr/local/lib/node_modules/@antora/site-generator-default/node_modules/nodegit/vendor/openssl/openssl
/usr/local/lib/node_modules/@antora/site-generator-default/node_modules/nodegit/vendor/libssh2/configure: line 2059: config.log: Permission denied
/usr/local/lib/node_modules/@antora/site-generator-default/node_modules/nodegit/vendor/libssh2/configure: line 2069: config.log: Permission denied

    at ChildProcess.exithandler (child_process.js:273:12)
    at ChildProcess.emit (events.js:180:13)
    at maybeClose (internal/child_process.js:936:16)
    at Socket.stream.socket.on (internal/child_process.js:353:11)
    at Socket.emit (events.js:180:13)
    at Pipe._handle.close [as _onclose] (net.js:541:12)
  killed: false,
  code: 1,
  signal: null,
  cmd: '/usr/local/lib/node_modules/@antora/site-generator-default/node_modules/nodegit/vendor/libssh2/configure --with-libssl-prefix=/usr/local/lib/node_modules/@antora/site-generator-default/node_modules/nodegit/vendor/openssl/openssl' }
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! nodegit@0.21.2 install: `node lifecycleScripts/preinstall && node lifecycleScripts/install`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the nodegit@0.21.2 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/me/.npm/_logs/2018-04-03T15_39_33_635Z-debug.log

I've tried upgrading all packages mentioned above, even creating a system wide link, nothing seems to work. Any idea?

This is the debug.log file:

10747 silly install nodegit@0.21.2
10748 info lifecycle nodegit@0.21.2~install: nodegit@0.21.2
10749 verbose lifecycle nodegit@0.21.2~install: unsafe-perm in lifecycle false
10750 verbose lifecycle nodegit@0.21.2~install: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/usr/local/lib/node_modules/@antora/site-generator-default/node_modules/nodegit/node_modules/.bin:/usr/local/lib/node_modules/@antora/site-generator-default/node_modules/.bin:/usr/local/lib/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
10751 verbose lifecycle nodegit@0.21.2~install: CWD: /usr/local/lib/node_modules/@antora/site-generator-default/node_modules/nodegit
10752 silly lifecycle nodegit@0.21.2~install: Args: [ '-c',
10752 silly lifecycle   'node lifecycleScripts/preinstall && node lifecycleScripts/install' ]
10753 silly lifecycle nodegit@0.21.2~install: Returned: code: 1  signal: null
10754 info lifecycle nodegit@0.21.2~install: Failed to exec install script
10755 verbose unlock done using /home/me/.npm/_locks/staging-3a08f0df5026584d.lock for /usr/local/lib/node_modules/.staging
10756 verbose stack Error: nodegit@0.21.2 install: `node lifecycleScripts/preinstall && node lifecycleScripts/install`
10756 verbose stack Exit status 1
10756 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:285:16)
10756 verbose stack     at EventEmitter.emit (events.js:180:13)
10756 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
10756 verbose stack     at ChildProcess.emit (events.js:180:13)
10756 verbose stack     at maybeClose (internal/child_process.js:936:16)
10756 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
10757 verbose pkgid nodegit@0.21.2
10758 verbose cwd /home/me/zenko-docs
10759 verbose Linux 4.4.0-72-generic
10760 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "@antora/site-generator-default"
10761 verbose node v9.10.1
10762 verbose npm  v5.6.0
10763 error code ELIFECYCLE
10764 error errno 1
10765 error nodegit@0.21.2 install: `node lifecycleScripts/preinstall && node lifecycleScripts/install`
10765 error Exit status 1
10766 error Failed at the nodegit@0.21.2 install script.
10766 error This is probably not a problem with npm. There is likely additional logging output above.
10767 verbose exit [ 1, true ]
commented

Do you who is the owner of the folder /usr/local/lib/node_modules/ ? You may need to get root privileges to run the command...

I run it as sudo; it's indeed owned by root:root

I don't know much about the reason of this issue, but I can testify that installing the following packages on Ubuntu 17.10 workarounds the problem:

  • build-essential,
  • libssl-dev.

My 2 cents 💸

Thank @jljouannic , that doesn't solve it for me... any luck with anyone else?

@LaureVergeron The references to /usr/local/lib/node_modules in the log are a big red flag to me that npm has exited the user-space sandbox and is attempting to install packages system-wide. In general, I always recommend against doing this. I've also noticed that nodegit seems to have trouble in these scenario even when running as root (or sudo).

What I strongly recommend is to use nvm, which sandboxes your node installation inside your home directory. By doing so, npm install won't impact your system and you should not have any permission issues. I'm quite confident that you will have success if you use nvm.

@mojavelinux :
Thanks for your help.
I must have missed something because it doesnt work for me; here's my process:

$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash

I get the same error after that. To be fair, I tried on a MacOS too and get a similar mistake. Not sure how I should configure nvm to solve that. Any pointers?

(furthermore, I may have missed something, but it's not surprising that it should try to install the packages system wide as the antora doc recommends using the -g option with npm which, by defaults, installs in /usr/local/.node_modules/ ; is that correct? )

it's not surprising that it should try to install the packages system wide as the antora doc recommends using the -g option with npm which, by defaults, installs in /usr/local/.node_modules/ ; is that correct?

@LaureVergeron I'm afraid it's not. npm -g installs packages in /usr/local/node_modules if npmis run with sudo, which, like @mojavelinux, I do not recommend.

I suggest you start again from scratch:

  • Install nvm following the project README,
  • Install node thanks to nvm:
    $ nvm install v8
  • try again npm install in your project root folder.

@LaureVergeron To clarify, the -g flag tells npm to install the package wherever Node is installed. nvm installs Node in your home directory, so npm -g install will put the package under ~/.nvm/versions/node.

I'm sorry to hear that nodegit installation is giving you trouble and I'm eager to help. However, I think we should pick up the discussion in the Antora channel since we're now talking about more general topics such as nvm and global package management.

When using nvm, you should not be using sudo.

/usr/share/CycligentGitTool/CycligentGitTool
A JavaScript error occurred in the main process
Uncaught Exception:
Error: /usr/lib/libcurl.so.4: version `CURL_OPENSSL_3' not found (required by /usr/share/CycligentGitTool/resources/app/cygit/server/node_modules/nodegit-electron-linux-x64/build/Release/nodegit.node)
at Error (native)
at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:173:20)
at Object.Module._extensions..node (module.js:583:18)
at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:173:20)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
at Module.require (module.js:483:17)
at require (internal/module.js:20:19)
at Object. (/usr/share/CycligentGitTool/resources/app/cygit/server/node_modules/nodegit-electron-linux-x64/dist/nodegit.js:11:12)
On Manjaro :(