From 2289909374f1aabf4232b4578aaee176b989edaa Mon Sep 17 00:00:00 2001 From: Li Zheng Date: Sat, 24 Sep 2016 17:44:51 -0700 Subject: [PATCH] Fix ENOENT when react-native init with --verbose on Windows Summary: As PR #5171 was reverted in 521bd03f0a94df35e21d368a3416599f5f01f5dc 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 --- react-native-cli/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/react-native-cli/index.js b/react-native-cli/index.js index 1580136cbf5..4beea40ccc1 100755 --- a/react-native-cli/index.js +++ b/react-native-cli/index.js @@ -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');