src/pai-bot/src/module-ext/learn.js
function npmInstall(packageName)
{
    return new Promise((resolve,reject) => {
        
        npm.load({
            save:false,
			progress: false,
            force:true
        }, function (er) {
            if (er)
            {
                PAILogger.error(er);
				return reject(er);
			}
            
            npm.commands.install([packageName], function (er, data) {
                if (er) {
					PAILogger.error(er);
					return reject(er);
                }
                resolve(data);
                // command succeeded, and data might have some info
            });
            
        });
        
    });
}
function npmInstall(packageName)
{
    return new Promise((resolve,reject) => {
        
        npm.load({
            save:false,
			progress: false,
            force:true
        }, function (er) {
            if (er)
            {
                PAILogger.error(er);
				return reject(er);
			}
            
            npm.commands.install([packageName], function (er, data) {
                if (er) {
					PAILogger.error(er);
					return reject(er);
                }
                resolve(data);
                // command succeeded, and data might have some info
            });
            
        });
        
    });
}
function npmInstall ( packageName ) { return new Promise ( ( resolve , reject ) => { npm . load ( { save : false , progress : false , force : true } , function ( er ) { if ( er ) { PAILogger . error ( er ) ; return reject ( er ) ; } npm . commands . install ( [ packageName ] , function ( er , data ) { if ( er ) { PAILogger . error ( er ) ; return reject ( er ) ; } resolve ( data ) ; // command succeeded, and data might have some info } ) ; } ) ; } ) ; }
Install new NPM package
@param {String} packageName
@return {Promise<any>}
Install new NPM package