Skip to content

Commit

Permalink
chrisa#95 Install fails with yarn
Browse files Browse the repository at this point in the history
  • Loading branch information
melloc committed Jun 12, 2017
1 parent dbc47c8 commit 1d3a7f4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 25 deletions.
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "dtrace-provider",
"version": "0.8.2",
"version": "0.8.3",
"description": "Native DTrace providers for node.js applications",
"keywords": [
"dtrace",
Expand Down
39 changes: 15 additions & 24 deletions scripts/install.js
Expand Up @@ -11,45 +11,36 @@ var path = require('path');
var src = path.join(__dirname, '..', 'compile.py');
var dst = path.join(__dirname, '..', 'binding.gyp');

console.log(process.env.PATH);

fs.renameSync(src, dst);

movedFile = true;

//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',
'node_modules',
'npm',
'bin',
'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';

if (process.env.V)
if (process.env.V) {
stdio = 'inherit';
}

var options = {
cwd: path.join(__dirname, '..'),
stdio: stdio
};

var child = spawn(nodegyp, ['rebuild'], options);
var child = spawn('node-gyp', [ 'rebuild' ], options);

child.on('error', function (err) {
if (err.code === 'ENOENT') {
console.error('cannot locate node-gyp');
} else {
console.error(err);
}

process.exit(0);
});

child.on('close', function(code, signal) {
if ((code || signal) && process.env.V === undefined) {
Expand Down

0 comments on commit 1d3a7f4

Please sign in to comment.