Skip to content

Commit 699a0be

Browse files
rh389facebook-github-bot
authored andcommitted
Fail gracefully for node<4 in react-native-cli (const->var)
Summary: `const` declarations were recently introduced into https://github.com/facebook/react-native/blob/master/react-native-cli/index.js, which runs before any transpilation so needs to be old-school. Replace them with `var`. Fixes facebook#11603 Closes facebook#11615 Differential Revision: D5148448 Pulled By: shergin fbshipit-source-id: ea23cdd26c0c1d0ac7f108aa9bf185abecfe399c
1 parent 46b3a89 commit 699a0be

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

react-native-cli/index.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
// The only reason to modify this file is to add more warnings and
2727
// troubleshooting information for the `react-native init` command.
2828
//
29+
// To allow for graceful failure on older node versions, this file should
30+
// retain ES5 compatibility.
31+
//
2932
// Do not make breaking changes! We absolutely don't want to have to
3033
// tell people to update their global version of react-native-cli.
3134
//
@@ -266,9 +269,9 @@ function getInstallPackage(rnPackage) {
266269
}
267270

268271
function run(root, projectName, options) {
269-
const rnPackage = options.version; // e.g. '0.38' or '/path/to/archive.tgz'
270-
const forceNpmClient = options.npm;
271-
const yarnVersion = (!forceNpmClient) && getYarnVersionIfAvailable();
272+
var rnPackage = options.version; // e.g. '0.38' or '/path/to/archive.tgz'
273+
var forceNpmClient = options.npm;
274+
var yarnVersion = (!forceNpmClient) && getYarnVersionIfAvailable();
272275
var installCommand;
273276
if (options.installCommand) {
274277
// In CI environments it can be useful to provide a custom command,

0 commit comments

Comments
 (0)