create-react-app: Build fails: Could not find plugin "proposal-numeric-separator"
Describe the bug
Running npm run build will fail on any project, even on a vanilla app created with create-react-app will fail with the following error:
Error: [BABEL] /Users/<username>/Projects/my-app/src/index.js: Could not find plugin "proposal-numeric-separator". Ensure there is an entry in ./available-plugins.js for it. (While processing: "/Users/<username>/Projects/my-app/node_modules/babel-preset-react-app/index.js$0")
at Array.map (<anonymous>)
at Generator.next (<anonymous>)
at Generator.next (<anonymous>)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my-app@0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the my-app@0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
From our build pipelines I can tell it started roughly around Mar 20, 2020 4:48pm GMT+0100
Did you try recovering your dependencies?
I tried recovering the module tree and even verified with a vanilla app. It happens on my local machine and on our build machines with no changes involved there.
$ npm --version
6.13.1
Which terms did you search for in User Guide?
(Write your answer here if relevant.)
Environment
$ npx create-react-app --info
Environment Info:
System:
OS: macOS 10.15.3
CPU: (8) x64 Intel(R) Core(TM) i7-8559U CPU @ 2.70GHz
Binaries:
Node: 13.2.0 - /usr/local/bin/node
Yarn: 1.19.2 - /usr/local/bin/yarn
npm: 6.13.1 - /usr/local/bin/npm
Browsers:
Chrome: 80.0.3987.149
Firefox: 68.0.2
Safari: 13.0.5
npmPackages:
react: ^16.13.1 => 16.13.1
react-dom: ^16.13.1 => 16.13.1
react-scripts: 3.4.0 => 3.4.0
npmGlobalPackages:
create-react-app: Not Found
Steps to reproduce
npx create-react-app my-appcd my-appnpm run build
Expected behavior
The build is successful with no error.
Reproducible demo
As mentioned in the above sections a vanilla app is enough to reproduce.
npx create-react-app my-appcd my-appnpm run build
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 223
- Comments: 79 (7 by maintainers)
Commits related to this issue
- Workaround for deploy to work. Source: https://github.com/facebook/create-react-app/issues/8680#issuecomment-601846409 — committed to AlbertoPdRF/weather-app by AlbertoPdRF 4 years ago
- đ Fix babel build Workaround from https://github.com/facebook/create-react-app/issues/8680#issuecomment-601851525 — committed to pauloo27/homepage by pauloo27 4 years ago
- temporary fix for: https://github.com/facebook/create-react-app/issues/8680 hard-code dependency for now — committed to wilfred-dev/website by vilhelmprytz 4 years ago
- Resolve Babel problem https://github.com/facebook/create-react-app/issues/8680#issuecomment-601851525 — committed to JannickFaber/covidiary by iGore 4 years ago
â ď¸ Workaround â ď¸
If you are using
yarn, you can add this to yourpackage.json:If you are using
npm, you can do the same thing but also neednpm-force-resolutionsThen, donât forget to run
yarn installornpm install.EDIT: See https://github.com/facebook/create-react-app/issues/8680#issuecomment-601896916 for more detailed instructions for npm.
For people who are looking for npm version of @nicolo-ribaudo 's workaround, here are the exact steps I took:
"resolutions": { "@babel/preset-env": "^7.8.7" }to package.jsonnpm install npm-force-resolutions --save-devnpm installnpx npm-force-resolutionsnpm installagainnpm run buildHey everyone, thumbs up the original post. Adding âme tooâ just becomes noise to the maintainers
This bug was fixed in Babel by https://github.com/babel/babel/pull/11201, and here once https://github.com/facebook/create-react-app/pull/8620 gets released.
This is what we get for deploying on a Friday⌠haha
Thanks everyone for the quick responses and easy workarounds! The package.json fix from @nicolo-ribaudo worked for us as well.
npm run eject"babel-preset-react-app": "9.0.0"(note: use exactly â9.0.0â, not â^9.0.0â)npm iQuick fix: Downgrading to"react-scripts": "^2.1.5",worked for my team!! No ejection necessaryEDIT: update thanks to @mohsenari:
Still broken?
affecting me as well.
+1
Rolling back
react-scriptsto3.0.0worked for me. Decided to go this route because it did not require ejecting or changing our build script to include the force resolve thing.I had to add
SKIP_PREFLIGHT_CHECK=trueto.envfile to make the build work without ejectingWARNING running command eject is one-way operation.
thanks to @nicolo-ribaudo, the solution works with react-scripts 3.3.1
As @leetmachine says delete node_modules and yarn.lock
This worked for me as did the downgrading of react-scripts separately.
The problem is in babel-preset-react-app. For some reason when you install it, it strictly requires @babel/preset-env@7.8.4.
It looks like itâs already updated to require @babel/preset-env@7.8.7 11 days ago in the package.json for babel-preset-react-app.
I had to use the workaround above combined with using the npm-force-resolutions* package.
*Note that this requires a complete package-lock.json with the transitive dependencies that need updating.
This should only need to be done temporarily until the issue outlined above is fixed.
Edit - Just want to add that Iâm able to use react-scripts@3.4.0
Just change your package.json to: âreact-scriptsâ: â3.0.0â,
@arinhouck 7.8.0-7.8.6 are the broken version. Try
7.8.7,7.7.0or7.9.0.â ď¸
Please add đ to existing comments if a solution worked for you, or if you have the same problem. New comments which donât add new information donât help.
@stenwie0591 our team is also experiencing error on Heroku deploy for a node react app using yarn. Workaround is not doing anything for us either.
We are seeing the following error:
Not seeing the issue happen when building locally, however specified
"@babel/preset-env": "^7.8.0",and ran yarn install and then it reproduced locally. It seems like heroku is bumping or not respecting lock file?./src/index.jsx Error: [BABEL] ndex.jsx: Could not find plugin âproposal-numeric-separatorâ. Ensure there is an entry in ./available-plugins.js for it. (While processing: ânode_modules/babel-preset-react-app/index.js$0â) at Array.map (<anonymous>) at Generator.next (<anonymous>) at Generator.next (<anonymous>)
I get this with
preset-envworkaround:Doesn`t work for me
same problem đ
@arinhouck We have an open PR for that, I hope to release it soon.
@arinhouck see my message above re:
Unknown helper createSuperđPlease note that we fixed this bug 2 weeks ago in
@babel/preset-env7.8.7 đFYI, the bug was that
@babel/preset-env7.8.0-7.8.6 throw if we add any new feature to newerpreset-envversions.@arinhouck for me the error is:
Error: [BABEL] /tmp/build_9bf569961355c452d38b6129ae4a762b/client/src/index.jsx: Could not find plugin âproposal-numeric-separatorâ. Ensure there is an entry in ./available-plugins.js for it. (While processing: â/tmp/build_9bf569961355c452d38b6129ae4a762b/client/node_modules/babel-preset-react-app/index.js$0â)
I did a lot of rollback for a definitely working versions but still get the same error. I hope fix soon.
I found the same error during a deploy on Heroku. Has this happened to anyone else? ps. i tried also for the Workaround, but it didnât worked!
its 7.8.4
@cph2117 I donât believe so, I tested in two instances one with âreact-scriptsâ: â3.3.0â and another with âreact-scriptsâ: â3.4.0â in package.json
@mohsenari Is there a specific version of react-scripts required for this workaround?
Thanks, worked for me đ
I used these steps successfullyâbased on the excellent workarounds listed above, just consolidated multiple steps:
Install npm-force-resolutions
npm i npm-force-resolutions --save-devModify package.json
npx npm-force-resolutionsIâm using babel-loader@8.0.6, but still have the issue