mirror of
https://github.com/Unitech/pm2.git
synced 2025-12-08 20:35:53 +00:00
bugfix : spawing npm install of module not working on Windows & node < v6.x.x (issue #2223)
This commit is contained in:
parent
3b75c46cdb
commit
30d90b7d5b
@ -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');
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user