Fix ENOENT when react-native init with --verbose on Windows

Summary:
As PR #5171 was reverted in 521bd03f0a for breaking reason, ENOENT again in issues #5169 , this commit fix it ref to https://github.com/nodejs/node-v0.x-archive/issues/2318#issuecomment-249355505 , and this is the smallest change in file to fix such Windows platform specific bug tdzl2003 mkonicek snowdream sunnylqm
Closes https://github.com/facebook/react-native/pull/10086

Differential Revision: D3919761

Pulled By: bestander

fbshipit-source-id: b878bbade8142a87bd6703d485e501eb28761af5
This commit is contained in:
Li Zheng 2016-09-24 17:44:51 -07:00 committed by Facebook Github Bot 7
parent 9f792c2bae
commit 2289909374
1 changed files with 1 additions and 1 deletions

View File

@ -230,7 +230,7 @@ function run(root, projectName, rnPackage) {
}
function runVerbose(root, projectName, rnPackage) {
var proc = spawn('npm', ['install', '--verbose', '--save', '--save-exact', getInstallPackage(rnPackage)], {stdio: 'inherit'});
var proc = spawn(/^win/.test(process.platform) ? 'npm.cmd' : 'npm', ['install', '--verbose', '--save', '--save-exact', getInstallPackage(rnPackage)], {stdio: 'inherit'});
proc.on('close', function (code) {
if (code !== 0) {
console.error('`npm install --save --save-exact react-native` failed');