index.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #!/usr/bin/env node
  2. /**
  3. * Copyright (c) 2015-present, Facebook, Inc.
  4. *
  5. * This source code is licensed under the MIT license found in the
  6. * LICENSE file in the root directory of this source tree.
  7. */
  8. // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  9. // /!\ DO NOT MODIFY THIS FILE /!\
  10. // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  11. //
  12. // create-react-app is installed globally on people's computers. This means
  13. // that it is extremely difficult to have them upgrade the version and
  14. // because there's only one global version installed, it is very prone to
  15. // breaking changes.
  16. //
  17. // The only job of create-react-app is to init the repository and then
  18. // forward all the commands to the local version of create-react-app.
  19. //
  20. // If you need to add a new command, please add it to the scripts/ folder.
  21. //
  22. // The only reason to modify this file is to add more warnings and
  23. // troubleshooting information for the `create-react-app` command.
  24. //
  25. // Do not make breaking changes! We absolutely don't want to have to
  26. // tell people to update their global version of create-react-app.
  27. //
  28. // Also be careful with new language features.
  29. // This file must work on Node 0.10+.
  30. //
  31. // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  32. // /!\ DO NOT MODIFY THIS FILE /!\
  33. // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  34. 'use strict';
  35. var currentNodeVersion = process.versions.node;
  36. var semver = currentNodeVersion.split('.');
  37. var major = semver[0];
  38. if (major < 8) {
  39. console.error(
  40. 'You are running Node ' +
  41. currentNodeVersion +
  42. '.\n' +
  43. 'Create React App requires Node 8 or higher. \n' +
  44. 'Please update your version of Node.'
  45. );
  46. process.exit(1);
  47. }
  48. require('./createReactApp');