Nodegit: Fails to install on macOS 10.12 (Sierra)

Created on 10 Sep 2016  ยท  6Comments  ยท  Source: nodegit/nodegit

Using Node.js v6.5.0, npm v3.10.3, and [email protected] (i.e. the current ['dist-tags'].latest):


npm install nodegit

$ npm install nodegit
> [email protected] preinstall /Users/spencerelliott/node_modules/.staging/nodegit-fe8a5bc2
> node lifecycleScripts/preinstall

[nodegit] Running pre-install script
[nodegit] Configuring libssh2.
{ Error: Command failed: /Users/spencerelliott/node_modules/.staging/nodegit-fe8a5bc2/vendor/libssh2/configure --with-libssl-prefix=/Users/spencerelliott/node_modules/.staging/nodegit-fe8a5bc2/vendor/openssl/openssl
configure: error: cannot find OpenSSL or Libgcrypt,
try --with-libssl-prefix=PATH or --with-libgcrypt-prefix=PATH

    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 Socket.<anonymous> (internal/child_process.js:334:11)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at Pipe._handle.close [as _onclose] (net.js:493:12)
  killed: false,
  code: 1,
  signal: null,
  cmd: '/Users/spencerelliott/node_modules/.staging/nodegit-fe8a5bc2/vendor/libssh2/configure --with-libssl-prefix=/Users/spencerelliott/node_modules/.staging/nodegit-fe8a5bc2/vendor/openssl/openssl' }
configure: error: cannot find OpenSSL or Libgcrypt,
try --with-libssl-prefix=PATH or --with-libgcrypt-prefix=PATH

[nodegit] ERROR - Could not finish preinstall
{ Error: Command failed: /Users/spencerelliott/node_modules/.staging/nodegit-fe8a5bc2/vendor/libssh2/configure --with-libssl-prefix=/Users/spencerelliott/node_modules/.staging/nodegit-fe8a5bc2/vendor/openssl/openssl
configure: error: cannot find OpenSSL or Libgcrypt,
try --with-libssl-prefix=PATH or --with-libgcrypt-prefix=PATH

    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 Socket.<anonymous> (internal/child_process.js:334:11)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at Pipe._handle.close [as _onclose] (net.js:493:12)
  killed: false,
  code: 1,
  signal: null,
  cmd: '/Users/spencerelliott/node_modules/.staging/nodegit-fe8a5bc2/vendor/libssh2/configure --with-libssl-prefix=/Users/spencerelliott/node_modules/.staging/nodegit-fe8a5bc2/vendor/openssl/openssl' }
/Users/spencerelliott
โ””โ”€โ”ฌ [email protected]
  โ””โ”€โ”ฌ [email protected]
    โ”œโ”€โ”€ [email protected]
    โ””โ”€โ”€ [email protected]

npm WARN enoent ENOENT: no such file or directory, open '/Users/spencerelliott/package.json'
npm WARN spencerelliott No description
npm WARN spencerelliott No repository field.
npm WARN spencerelliott No README data
npm WARN spencerelliott No license field.
npm ERR! Darwin 16.0.0
npm ERR! argv "/Users/spencerelliott/.config/fnm/bin/node" "/Users/spencerelliott/.config/fnm/bin/npm" "i" "nodegit"
npm ERR! node v6.5.0
npm ERR! npm  v3.10.3
npm ERR! code ELIFECYCLE

npm ERR! [email protected] preinstall: `node lifecycleScripts/preinstall`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] preinstall script 'node lifecycleScripts/preinstall'.
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
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/spencerelliott/npm-debug.log

The same error occurs with [email protected], and Node.js v4.5.0 / npm v2.15.9.

I'm using the latest macOS Sierra GM (macOS 10.12 (16A320))

Most helpful comment

After upgrading to sierra, I upgraded to xcode 8 (and made sure I started it up once)

I then encountered this problem.

I then ran:
brew install openssl
and
sudo xcode-select --install

as mentioned above and it seems able to install nodegit now (sierra, xcode8). Thanks for the tips!

All 6 comments

So node 6.5 is an expected failure currently, but can you try node 6.2?
4 is a bit more curious, although I bet the openssl exports got backported.

Yep, here's with Node v6.2.2 / npm v3.9.5:


npm i nodegit

$ npm i nodegit
> [email protected] preinstall /Users/spencerelliott/Desktop/node_modules/.staging/nodegit-5c00eacf
> node lifecycleScripts/preinstall

[nodegit] Running pre-install script
[nodegit] Configuring libssh2.
{ Error: Command failed: /Users/spencerelliott/Desktop/node_modules/.staging/nodegit-5c00eacf/vendor/libssh2/configure --with-libssl-prefix=/Users/spencerelliott/Desktop/node_modules/.staging/nodegit-5c00eacf/vendor/openssl/openssl
configure: error: cannot find OpenSSL or Libgcrypt,
try --with-libssl-prefix=PATH or --with-libgcrypt-prefix=PATH

    at ChildProcess.exithandler (child_process.js:207:12)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:852:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)
  killed: false,
  code: 1,
  signal: null,
  cmd: '/Users/spencerelliott/Desktop/node_modules/.staging/nodegit-5c00eacf/vendor/libssh2/configure --with-libssl-prefix=/Users/spencerelliott/Desktop/node_modules/.staging/nodegit-5c00eacf/vendor/openssl/openssl' }
configure: error: cannot find OpenSSL or Libgcrypt,
try --with-libssl-prefix=PATH or --with-libgcrypt-prefix=PATH

[nodegit] ERROR - Could not finish preinstall
{ Error: Command failed: /Users/spencerelliott/Desktop/node_modules/.staging/nodegit-5c00eacf/vendor/libssh2/configure --with-libssl-prefix=/Users/spencerelliott/Desktop/node_modules/.staging/nodegit-5c00eacf/vendor/openssl/openssl
configure: error: cannot find OpenSSL or Libgcrypt,
try --with-libssl-prefix=PATH or --with-libgcrypt-prefix=PATH

    at ChildProcess.exithandler (child_process.js:207:12)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:852:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)
  killed: false,
  code: 1,
  signal: null,
  cmd: '/Users/spencerelliott/Desktop/node_modules/.staging/nodegit-5c00eacf/vendor/libssh2/configure --with-libssl-prefix=/Users/spencerelliott/Desktop/node_modules/.staging/nodegit-5c00eacf/vendor/openssl/openssl' }
/Users/spencerelliott/Desktop
โ””โ”€โ”€ (empty)

npm WARN enoent ENOENT: no such file or directory, open '/Users/spencerelliott/Desktop/package.json'
npm WARN Desktop No description
npm WARN Desktop No repository field.
npm WARN Desktop No README data
npm WARN Desktop No license field.
npm ERR! Darwin 16.0.0
npm ERR! argv "/Users/spencerelliott/.config/fnm/bin/node" "/Users/spencerelliott/.config/fnm/bin/npm" "i" "nodegit"
npm ERR! node v6.2.2
npm ERR! npm  v3.9.5
npm ERR! code ELIFECYCLE

npm ERR! [email protected] preinstall: `node lifecycleScripts/preinstall`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] preinstall script 'node lifecycleScripts/preinstall'.
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
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/spencerelliott/Desktop/npm-debug.log
npm ERR! code 1

Ah, shit. Something changed with their openssl lib.
if you have homebrew brew install openssl && brew link openssl --force will fix it.

For the actual issue that should resolve this, see here: https://github.com/nodegit/nodegit/issues/1093

@maxkorp I ran that line (on the final 10.12 sierra version out there) and got this output:

$ brew link openssl --force
Warning: Refusing to link: openssl
Linking keg-only openssl means you may end up linking against the insecure,
deprecated system OpenSSL while using the headers from Homebrew's openssl.
Instead, pass the full include/library paths to your compiler e.g.:
  -I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib

@dorongutman can you run sudo xcode-select --install and reinstall the CLT for xcode?

After upgrading to sierra, I upgraded to xcode 8 (and made sure I started it up once)

I then encountered this problem.

I then ran:
brew install openssl
and
sudo xcode-select --install

as mentioned above and it seems able to install nodegit now (sierra, xcode8). Thanks for the tips!

Was this page helpful?
0 / 5 - 0 ratings