mirror of
https://github.com/zhigang1992/create-react-app.git
synced 2026-04-23 20:51:12 +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:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user