diff --git a/build.js b/build.js index 62acea9..e1a6ef2 100644 --- a/build.js +++ b/build.js @@ -1,4 +1,5 @@ var spawn = require('cross-spawn') +var npmRunPath = require('npm-run-path') var runtime = process.env.npm_config_runtime || 'node' var target = process.env.npm_config_target || process.versions.node @@ -6,12 +7,14 @@ var abi = process.env.npm_config_abi || process.versions.modules console.log('BUILD for %s@%s (abi=%s)', runtime, target, abi) -var ps = spawn(`${__dirname}/node_modules/.bin/cmake-js`, [ +var ps = spawn('cmake-js', [ 'rebuild', '-r', runtime, '-v', target, '--abi', abi -]) +], { + env: npmRunPath.env() +}) ps.stdout.pipe(process.stdout) ps.stderr.pipe(process.stderr) ps.on('exit', function (code) { diff --git a/package-lock.json b/package-lock.json index e1df2e3..6f4b1dd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -832,6 +832,14 @@ "abbrev": "1.1.0" } }, + "npm-run-path": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", + "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", + "requires": { + "path-key": "2.0.1" + } + }, "npmconf": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/npmconf/-/npmconf-2.1.2.tgz", @@ -932,6 +940,11 @@ "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" }, + "path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=" + }, "performance-now": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-0.2.0.tgz", diff --git a/package.json b/package.json index 3378825..20b6432 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,8 @@ "dependencies": { "cmake-js": "^3.5.0", "cross-spawn": "^5.1.0", - "nan": "^2.4.0" + "nan": "^2.4.0", + "npm-run-path": "^2.0.2" }, "devDependencies": { "mkdirp": "^0.5.1",