From fe6424c200e754960512dc0305a9ac4d03eb7660 Mon Sep 17 00:00:00 2001 From: Timothy J Fontaine Date: Sat, 25 Oct 2014 10:41:47 -0700 Subject: [PATCH] handle installs from decoupled npm Fixes #52 #53 --- scripts/install.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/scripts/install.js b/scripts/install.js index f67a8c2..c11f5e5 100755 --- a/scripts/install.js +++ b/scripts/install.js @@ -15,7 +15,14 @@ fs.renameSync(src, dst); movedFile = true; -var nodegyp = path.join(process.execPath, +//npm_execpath: '/usr/local/lib/node_modules/npm/bin/npm-cli.js', +var nodegyp = path.join(process.env.npm_execpath, + '..', + 'node-gyp-bin', + 'node-gyp'); + +if (!fs.existsSync(nodegyp)) + nodegyp = path.join(process.execPath, '..', '..', 'lib', @@ -25,6 +32,11 @@ var nodegyp = path.join(process.execPath, 'node-gyp-bin', 'node-gyp'); +if (!fs.existsSync(nodegyp)) { + console.error('cannot locate npm install'); + return; +} + var spawn = require('child_process').spawn; var stdio = 'ignore';