use correct npm when running c9 install on docker workspaces

This commit is contained in:
nightwing 2015-07-15 23:31:32 +04:00
parent 780dbe57ed
commit 527ffb72b8

View File

@ -291,12 +291,21 @@ define(function(require, exports, module) {
prepareDirectory(function(err, packagePath){
if (err) return callback(err);
var npmBin = [
join(process.env.HOME, process.platform == "win32"? ".c9/npm.cmd" : ".c9/node/bin/npm"),
"/mnt/shared/sbin/npm"
];
function installNPM(){
spawn(join(process.env.HOME, process.platform == "win32"? ".c9/npm.cmd" : ".c9/node/bin/npm"), {
spawn(npmBin[0], {
args: ["install"],
cwd: packagePath
}, function(err) {
if (err && err.code == 127) {
npmBin.shift();
if (npmBin.length)
return installNPM();
}
if (err) return callback(err);
callback(null, { version: version });
});