Skip to content

Commit e91ba24

Browse files
ianschmitzromaindso
authored andcommitted
Bump minimal Node version to 6 (facebook#1897)
* Bump minimal Node version to 4.7.0 * Bump minimal Node version to 4.7.0 Modified additional files that needed a bump to 4.7.0 minimum node version * Bump minimal Node version to 4.7.0 Reverse changes to packages/create-react-app/index.js as this file needs to continue to work on Node 0.10+ * Bump minimal node version to 6 * Bump minimal node version to 6 * Bump minimal node version to 6
1 parent 16f402c commit e91ba24

File tree

9 files changed

+26
-30
lines changed

9 files changed

+26
-30
lines changed

.travis.yml

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
---
22
language: node_js
33
node_js:
4-
- 4
54
- 6
65
- 7
76
cache:

README.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@ Install it once globally:
4040
npm install -g create-react-app
4141
```
4242

43-
**You’ll need to have Node >= 4 on your machine**.
44-
45-
**We strongly recommend to use Node >= 6 and npm >= 3 for faster installation speed and better disk usage.** You can use [nvm](https://github.com/creationix/nvm#usage) to easily switch Node versions between different projects.
43+
**You’ll need to have Node >= 6 on your machine**. You can use [nvm](https://github.com/creationix/nvm#usage) to easily switch Node versions between different projects.
4644

4745
**This tool doesn’t assume a Node backend**. The Node installation is only required for Create React App itself.
4846

appveyor.yml

-6
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,6 @@ environment:
1414
test_suite: "installs"
1515
- nodejs_version: 6
1616
test_suite: "kitchensink"
17-
- nodejs_version: 4
18-
test_suite: "simple"
19-
- nodejs_version: 4
20-
test_suite: "installs"
21-
- nodejs_version: 4
22-
test_suite: "kitchensink"
2317

2418
cache:
2519
- node_modules -> appveyor.cleanup-cache.txt

packages/create-react-app/createReactApp.js

+12-13
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
// tell people to update their global version of create-react-app.
2929
//
3030
// Also be careful with new language features.
31-
// This file must work on Node 4+.
31+
// This file must work on Node 6+.
3232
//
3333
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3434
// /!\ DO NOT MODIFY THIS FILE /!\
@@ -398,24 +398,23 @@ function getPackageName(installPackage) {
398398
}
399399

400400
function checkNpmVersion() {
401-
let isNpm2 = false;
401+
let hasMinNpm = false;
402402
try {
403403
const npmVersion = execSync('npm --version').toString();
404-
isNpm2 = semver.lt(npmVersion, '3.0.0');
404+
hasMinNpm = semver.gte(npmVersion, '3.0.0');
405405
} catch (err) {
406406
return;
407407
}
408-
if (!isNpm2) {
409-
return;
408+
409+
if (!hasMinNpm) {
410+
console.error(
411+
chalk.red(
412+
'Create React App requires npm 3 or higher. \n' +
413+
'Please update your version of npm.'
414+
)
415+
);
416+
process.exit(1);
410417
}
411-
console.log(chalk.yellow('It looks like you are using npm 2.'));
412-
console.log(
413-
chalk.yellow(
414-
'We suggest using npm 3 or Yarn for faster install times ' +
415-
'and less disk space usage.'
416-
)
417-
);
418-
console.log();
419418
}
420419

421420
function checkNodeVersion(packageName) {

packages/create-react-app/index.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,16 @@
4141
var chalk = require('chalk');
4242

4343
var currentNodeVersion = process.versions.node;
44-
if (currentNodeVersion.split('.')[0] < 4) {
44+
var semver = currentNodeVersion.split('.');
45+
var major = semver[0];
46+
47+
if (major < 6) {
4548
console.error(
4649
chalk.red(
4750
'You are running Node ' +
4851
currentNodeVersion +
4952
'.\n' +
50-
'Create React App requires Node 4 or higher. \n' +
53+
'Create React App requires Node 6 or higher. \n' +
5154
'Please update your version of Node.'
5255
)
5356
);

packages/create-react-app/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"repository": "facebookincubator/create-react-app",
99
"license": "BSD-3-Clause",
1010
"engines": {
11-
"node": ">=4"
11+
"node": ">=6"
1212
},
1313
"bugs": {
1414
"url": "https://github.com/facebookincubator/create-react-app/issues"

packages/react-dev-utils/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"url": "https://github.com/facebookincubator/create-react-app/issues"
99
},
1010
"engines": {
11-
"node": ">=4"
11+
"node": ">=6"
1212
},
1313
"files": [
1414
"ansiHTML.js",

packages/react-scripts/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"repository": "facebookincubator/create-react-app",
66
"license": "BSD-3-Clause",
77
"engines": {
8-
"node": ">=4"
8+
"node": ">=6"
99
},
1010
"bugs": {
1111
"url": "https://github.com/facebookincubator/create-react-app/issues"

tasks/e2e-simple.sh

+5-2
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,11 @@ cd "$root_path"/packages/create-react-app
7676
npm install
7777
cd "$root_path"
7878

79-
# If the node version is < 4, the script should just give an error.
80-
if [[ `node --version | sed -e 's/^v//' -e 's/\..*//g'` -lt 4 ]]
79+
# If the node version is < 6, the script should just give an error.
80+
nodeVersion=`node --version | cut -d v -f2`
81+
nodeMajor=`echo $nodeVersion | cut -d. -f1`
82+
nodeMinor=`echo $nodeVersion | cut -d. -f2`
83+
if [[ nodeMajor -lt 6 ]]
8184
then
8285
cd $temp_app_path
8386
err_output=`node "$root_path"/packages/create-react-app/index.js test-node-version 2>&1 > /dev/null || echo ''`

0 commit comments

Comments
 (0)