MCPcopy Create free account
hub / github.com/react/create-react-app / checkNodeVersion

Function checkNodeVersion

packages/create-react-app/createReactApp.js:790–819  ·  view source on GitHub ↗
(packageName)

Source from the content-addressed store, hash-verified

788}
789
790function checkNodeVersion(packageName) {
791 const packageJsonPath = path.resolve(
792 process.cwd(),
793 'node_modules',
794 packageName,
795 'package.json'
796 );
797
798 if (!fs.existsSync(packageJsonPath)) {
799 return;
800 }
801
802 const packageJson = require(packageJsonPath);
803 if (!packageJson.engines || !packageJson.engines.node) {
804 return;
805 }
806
807 if (!semver.satisfies(process.version, packageJson.engines.node)) {
808 console.error(
809 chalk.red(
810 'You are running Node %s.\n' +
811 'Create React App requires Node %s or higher. \n' +
812 'Please update your version of Node.'
813 ),
814 process.version,
815 packageJson.engines.node
816 );
817 process.exit(1);
818 }
819}
820
821function checkAppName(appName) {
822 const validationResult = validateProjectName(appName);

Callers 1

runFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected