create-react-app: Babel Error on start - clean app
Describe the bug
I created a new/clean react app and on first run of the start script with no edits I get a Babel Error. See below for my CLI outout.
$ npx create-react-app price-grid
npx: installed 91 in 6.335s
Creating a new React app in C:\Users\soliver\Documents\react_module_dev\price-grid.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
> core-js@2.6.10 postinstall C:\Users\soliver\Documents\react_module_dev\price-grid\node_modules\babel-runtime\node_modules\core-js
> node postinstall || echo "ignore"
> core-js@3.2.1 postinstall C:\Users\soliver\Documents\react_module_dev\price-grid\node_modules\core-js
> node scripts/postinstall || echo "ignore"
> core-js-pure@3.4.7 postinstall C:\Users\soliver\Documents\react_module_dev\price-grid\node_modules\core-js-pure
> node -e "try{require('./postinstall')}catch(e){}"
+ react-dom@16.12.0
+ react@16.12.0
+ react-scripts@3.2.0
added 1483 packages from 695 contributors and audited 904941 packages in 50.992s
15 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
Initialized a git repository.
Success! Created price-grid at C:\Users\soliver\Documents\react_module_dev\price-grid
Inside that directory, you can run several commands:
npm start
Starts the development server.
npm run build
Bundles the app into static files for production.
npm test
Starts the test runner.
npm run eject
Removes this tool and copies build dependencies, configuration files
and scripts into the app directory. If you do this, you can’t go back!
We suggest that you begin by typing:
cd price-grid
npm start
Happy hacking!
soliver@IS-SO-WIN10 MINGW64 /c/Users/soliver/Documents/react_module_dev
$ cd price-grid/
soliver@IS-SO-WIN10 MINGW64 /c/Users/soliver/Documents/react_module_dev/price-grid (master)
$ npm start
> price-grid@0.1.0 start C:\Users\soliver\Documents\react_module_dev\price-grid
> react-scripts start
Starting the development server...
Failed to compile.
./node_modules/react-dev-utils/webpackHotDevClient.js
Error: [BABEL] C:\Users\soliver\Documents\react_module_dev\price-grid\node_modules\react-dev-utils\webpackHotDevClient.js: Cannot find module './src/data'
Require stack:
- C:\Users\soliver\Documents\react_module_dev\price-grid\node_modules\core-js-compat\helpers.js
- C:\Users\soliver\Documents\react_module_dev\price-grid\node_modules\core-js-compat\get-modules-list-for-target-version.js
- C:\Users\soliver\Documents\react_module_dev\price-grid\node_modules\babel-preset-react-app\node_modules\@babel\preset-env\lib\polyfills\corejs3\entry-plugin.js
- C:\Users\soliver\Documents\react_module_dev\price-grid\node_modules\babel-preset-react-app\node_modules\@babel\preset-env\lib\index.js
- C:\Users\soliver\Documents\react_module_dev\price-grid\node_modules\babel-preset-react-app\dependencies.js
- C:\Users\soliver\Documents\react_module_dev\price-grid\node_modules\@babel\core\lib\config\files\plugins.js
- C:\Users\soliver\Documents\react_module_dev\price-grid\node_modules\@babel\core\lib\config\files\index.js
- C:\Users\soliver\Documents\react_module_dev\price-grid\node_modules\@babel\core\lib\index.js
- C:\Users\soliver\Documents\react_module_dev\price-grid\node_modules\babel-loader\lib\index.js
- C:\Users\soliver\Documents\react_module_dev\price-grid\node_modules\loader-runner\lib\loadLoader.js
- C:\Users\soliver\Documents\react_module_dev\price-grid\node_modules\loader-runner\lib\LoaderRunner.js
- C:\Users\soliver\Documents\react_module_dev\price-grid\node_modules\webpack\lib\NormalModule.js
- C:\Users\soliver\Documents\react_module_dev\price-grid\node_modules\webpack\lib\NormalModuleFactory.js
- C:\Users\soliver\Documents\react_module_dev\price-grid\node_modules\webpack\lib\Compiler.js
- C:\Users\soliver\Documents\react_module_dev\price-grid\node_modules\webpack\lib\webpack.js
- C:\Users\soliver\Documents\react_module_dev\price-grid\node_modules\react-scripts\scripts\start.js (While processing: "C:\\Users\\soliver\\Documents\\react_module_dev\\price-grid\\node_modules\\babel-preset-react-app\\dependencies.js$0$9")
Did you try recovering your dependencies?
Followed the Recommended fix steps and issue persists.
NPM Version: 6.13.1
Which terms did you search for in User Guide?
‘npm start error’ ‘babel error’ ‘npm start babel error’
Environment
Environment Info:
System:
OS: Windows 10
CPU: (8) x64 Intel(R) Xeon(R) CPU E3-1285 v6 @ 4.10GHz
Binaries:
Node: 13.2.0 - C:\Program Files\nodejs\node.EXE
Yarn: Not Found
npm: 6.13.1 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: 44.18362.449.0
Internet Explorer: 11.0.18362.1
npmPackages:
react: ^16.12.0 => 16.12.0
react-dom: ^16.12.0 => 16.12.0
react-scripts: 3.2.0 => 3.2.0
npmGlobalPackages:
create-react-app: Not Found
Steps to reproduce
- run
npx create-react-app app-name
- enter command
cd app-name
- enter command
npm start
Expected behavior
Opens default react app in browser (no errors)
Actual behavior
Error output in CLI and Browser: (see description for CLI Error output)
Reproducible demo
I didn’t change anything from what is provide immediately after running create-react-app
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 20
- Comments: 15
Looks like it’s because the npm cache hasn’t been updated yet, it’s a bug in
core-js-compat
https://github.com/zloirock/core-js/issues/713should fix itself soon?
if you run
npm i -D core-js-compat@3.4.7
it should resolve the problem. Worked for me. https://github.com/parcel-bundler/parcel/issues/3864#issuecomment-560541229If you need it to work now and you cant wait for npm to be updated, you can run this: npm install core-js-compat@3.4.7 It made it work for me at least.
just as an update:
Looks like npm got their stuff fixed. It should work now as intended. (I just verified it on my machine)
npm steps:
npm install
As the create react app team likes to say… “Happy Hacking!” 😄
The fix has been released 1 hour ago but it isn’t downloaded by npm: https://github.com/npm/cli/issues/545 Please 👍 that issue.
Same issue for all 25 of my students.
Same for me, was working fine 2 hours ago