`npm run build` fails to compile on a fresh unmodified CRA app ("Class constructor Parser cannot be invoked without 'new'")
Created by: jebeck
Describe the bug
Completely fresh and unmodified create-react-app app fails to build with npm run build
. Error is Class constructor Parser cannot be invoked without 'new'
:
Did you try recovering your dependencies?
Probably N/A since completely fresh, unmodified output of initial npx create-react-app...
command, but yep, I did try. Did not help.
Which terms did you search for in User Guide?
Had a glance through the build section again, searched Google, and searched issues here for the specific error.
Environment
current version of create-react-app: 3.4.1
running from /Users/janabeck/.npm/_npx/50873/lib/node_modules/create-react-app
System:
OS: macOS 10.15.6
CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
Binaries:
Node: 12.18.3 - /var/folders/pq/gd8qpx2s5b95t3jnvrrx0nh40000gq/T/fnm-shell-2477482/bin/node
Yarn: Not Found
npm: 6.14.8 - /var/folders/pq/gd8qpx2s5b95t3jnvrrx0nh40000gq/T/fnm-shell-2477482/bin/npm
Browsers:
Chrome: 85.0.4183.102
Firefox: Not Found
Safari: 13.1.2
npmPackages:
react: Not Found
react-dom: Not Found
react-scripts: Not Found
npmGlobalPackages:
create-react-app: Not Found
And my coworker's, who verified the failure:
Environment Info:
current version of create-react-app: 3.4.1
running from /Users/robertharris/.npm/_npx/92901/lib/node_modules/create-react-app
System:
OS: macOS 10.15.6
CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
Binaries:
Node: 14.9.0 - /usr/local/bin/node
Yarn: Not Found
npm: 6.14.7 - /usr/local/bin/npm
Browsers:
Chrome: 85.0.4183.102
Firefox: Not Found
Safari: 13.1.2
npmPackages:
react: ^16.13.1 => 16.13.1
react-dom: ^16.13.1 => 16.13.1
react-scripts: 3.4.3 => 3.4.3
npmGlobalPackages:
create-react-app: Not Found
Steps to reproduce
npx create-react-app foo
cd foo/
npm run build
I also tried npx create-react-app@3.3.1...
to see if going back one minor version would change anything, but the result was the same.
Expected behavior
A fresh unmodified CRA app should build successfully.
Actual behavior (Same screenshot as above.)
Reproducible demo
Pushed my fresh unmodified CRA app here: https://github.com/jebeck/cra-build-failure
So just clone, npm i
, and npm run build
. I have also tested on a 3rd machine (in addition to mine and my coworker's) and I get the same failure.