Skip to content

Commit

Permalink
bugfix : spawing npm install of module not working on Windows & node …
Browse files Browse the repository at this point in the history
…< v6.x.x (issue #2223)
  • Loading branch information
vmarchaud committed Jul 6, 2016
1 parent 3b75c46 commit 30d90b7
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions lib/CLI/Modules/Modularizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,26 +104,27 @@ function installModule(CLI, module_name, cb) {
*/

//UX.processing.start('Downloading module');

Common.printOut(cst.PREFIX_MSG_MOD + 'Calling ' + chalk.bold.red('[NPM]') + ' registry...');
var install_instance;

install_instance = spawn('npm', [
install_instance = spawn(cst.IS_WINDOWS ? 'npm.cmd' : 'npm', [
'install', module_name, '--prefix', cst.PM2_ROOT_PATH, '--loglevel=error'
],{
stdio : 'inherit',
async : true,
env: process.env,
shell : cst.IS_WINDOWS
});

install_instance.on('close', finalize);

install_instance.on('error', function ( err ) {
// handle just to not crash
});

function finalize(code) {
// if (code != 0) {
// Common.printError(cst.PREFIX_MSG_MOD_ERR + 'Installation failed');
// console.log(err, code, out);
// return cb(new Error(err));
// }
if (code != 0) {
return cb(new Error("Installation failed"));
}

Common.printOut(cst.PREFIX_MSG_MOD + 'Module downloaded');

Expand Down

0 comments on commit 30d90b7

Please sign in to comment.