Use local npm version when available

This commit is contained in:
Kevin Sawicki
2014-06-10 11:45:11 -07:00
parent 562a047b9e
commit fe088ba16a

View File

@@ -40,7 +40,12 @@ function verifyNode(cb) {
}
function verifyNpm(cb) {
childProcess.execFile('npm', ['-v'], { env: process.env }, function(err, stdout) {
var localNpmPath = path.resolve(__dirname, '..', '..', 'build', 'node_modules', '.bin', 'npm');
if (process.platform === 'win32')
localNpmPath += ".cmd";
var npmCommand = fs.existsSync(localNpmPath) ? localNpmPath : 'npm';
childProcess.execFile(npmCommand, ['-v'], { env: process.env }, function(err, stdout) {
if (err)
return cb("npm 1.4 is required to build Atom. An error (" + err + ") occured when checking the version.");