mirror of
https://github.com/zhigang1992/create-react-app.git
synced 2026-01-12 22:46:30 +08:00
Bump minimal Node version to 6 (#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
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
---
|
||||
language: node_js
|
||||
node_js:
|
||||
- 4
|
||||
- 6
|
||||
- 7
|
||||
cache:
|
||||
|
||||
@@ -40,9 +40,7 @@ Install it once globally:
|
||||
npm install -g create-react-app
|
||||
```
|
||||
|
||||
**You’ll need to have Node >= 4 on your machine**.
|
||||
|
||||
**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.
|
||||
**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.
|
||||
|
||||
**This tool doesn’t assume a Node backend**. The Node installation is only required for Create React App itself.
|
||||
|
||||
|
||||
@@ -14,12 +14,6 @@ environment:
|
||||
test_suite: "installs"
|
||||
- nodejs_version: 6
|
||||
test_suite: "kitchensink"
|
||||
- nodejs_version: 4
|
||||
test_suite: "simple"
|
||||
- nodejs_version: 4
|
||||
test_suite: "installs"
|
||||
- nodejs_version: 4
|
||||
test_suite: "kitchensink"
|
||||
|
||||
cache:
|
||||
- node_modules -> appveyor.cleanup-cache.txt
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
// tell people to update their global version of create-react-app.
|
||||
//
|
||||
// Also be careful with new language features.
|
||||
// This file must work on Node 4+.
|
||||
// This file must work on Node 6+.
|
||||
//
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// /!\ DO NOT MODIFY THIS FILE /!\
|
||||
@@ -398,24 +398,23 @@ function getPackageName(installPackage) {
|
||||
}
|
||||
|
||||
function checkNpmVersion() {
|
||||
let isNpm2 = false;
|
||||
let hasMinNpm = false;
|
||||
try {
|
||||
const npmVersion = execSync('npm --version').toString();
|
||||
isNpm2 = semver.lt(npmVersion, '3.0.0');
|
||||
hasMinNpm = semver.gte(npmVersion, '3.0.0');
|
||||
} catch (err) {
|
||||
return;
|
||||
}
|
||||
if (!isNpm2) {
|
||||
return;
|
||||
|
||||
if (!hasMinNpm) {
|
||||
console.error(
|
||||
chalk.red(
|
||||
'Create React App requires npm 3 or higher. \n' +
|
||||
'Please update your version of npm.'
|
||||
)
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
console.log(chalk.yellow('It looks like you are using npm 2.'));
|
||||
console.log(
|
||||
chalk.yellow(
|
||||
'We suggest using npm 3 or Yarn for faster install times ' +
|
||||
'and less disk space usage.'
|
||||
)
|
||||
);
|
||||
console.log();
|
||||
}
|
||||
|
||||
function checkNodeVersion(packageName) {
|
||||
|
||||
@@ -41,13 +41,16 @@
|
||||
var chalk = require('chalk');
|
||||
|
||||
var currentNodeVersion = process.versions.node;
|
||||
if (currentNodeVersion.split('.')[0] < 4) {
|
||||
var semver = currentNodeVersion.split('.');
|
||||
var major = semver[0];
|
||||
|
||||
if (major < 6) {
|
||||
console.error(
|
||||
chalk.red(
|
||||
'You are running Node ' +
|
||||
currentNodeVersion +
|
||||
'.\n' +
|
||||
'Create React App requires Node 4 or higher. \n' +
|
||||
'Create React App requires Node 6 or higher. \n' +
|
||||
'Please update your version of Node.'
|
||||
)
|
||||
);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
"repository": "facebookincubator/create-react-app",
|
||||
"license": "BSD-3-Clause",
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
"node": ">=6"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/facebookincubator/create-react-app/issues"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
"url": "https://github.com/facebookincubator/create-react-app/issues"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
"node": ">=6"
|
||||
},
|
||||
"files": [
|
||||
"ansiHTML.js",
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"repository": "facebookincubator/create-react-app",
|
||||
"license": "BSD-3-Clause",
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
"node": ">=6"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/facebookincubator/create-react-app/issues"
|
||||
|
||||
@@ -76,8 +76,11 @@ cd "$root_path"/packages/create-react-app
|
||||
npm install
|
||||
cd "$root_path"
|
||||
|
||||
# If the node version is < 4, the script should just give an error.
|
||||
if [[ `node --version | sed -e 's/^v//' -e 's/\..*//g'` -lt 4 ]]
|
||||
# If the node version is < 6, the script should just give an error.
|
||||
nodeVersion=`node --version | cut -d v -f2`
|
||||
nodeMajor=`echo $nodeVersion | cut -d. -f1`
|
||||
nodeMinor=`echo $nodeVersion | cut -d. -f2`
|
||||
if [[ nodeMajor -lt 6 ]]
|
||||
then
|
||||
cd $temp_app_path
|
||||
err_output=`node "$root_path"/packages/create-react-app/index.js test-node-version 2>&1 > /dev/null || echo ''`
|
||||
|
||||
Reference in New Issue
Block a user