Could not find plugin "proposal-numeric-separator"
How to fix Could not find plugin "proposal-numeric-separator"
, I get this error when I try to build my React application, I have not ejected the application yet:
./src/index.js
Error: [BABEL] /home/pc/Downloads/project/src/index.js: Could not find plugin "proposal-numeric-separator". Ensure there is an entry in ./available-plugins.js for it. (While processing: "/home/pc/Downloads/project/node_modules/babel-preset-react-app/index.js$0")
at Array.map (<anonymous>)
at Generator.next (<anonymous>)
at Generator.next (<anonymous>)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
I have tried to download Babel and the dependency Proposal Numeric Separator, remove the Node Modules, clean the Yarn cache; but nothing worked.
I'm using Yarn 1.22.4 and Node 13.11.0, but I have also tried with NPM 6.13.7.
Solution 1:
The following steps work:
- Add the following line to
package.json
:
"resolutions": {
"@babel/preset-env": "7.5.5"
},
- Run the following command:
$ npx npm-force-resolutions
- Install dependencies:
$ npm install
# or
$ yarn
- Build your project:
$ yarn build
Take a look at this Github Issue
Solution 2:
Try this, it works: npm i @babel/[email protected]
I have just used it like 10 minutes ago, and it's working fine.
Related issue going on github about this. Click Here!
Solution 3:
From the corresponding issue in create-react-app,
Update react-scripts to 3.4.1 in your package.json file and remove node_modules as well as package-lock.json/yarn.lock and re-install.
Solution 4:
Why this problem happened?:
It's an issue of conflicts between internal packages used by babel
.
Adding a new plugin to @babel/compat-data
breaks old @babel/preset-env
versions. This is because preset-env
iterates over compat-data
's plugins, and throws if the plugin isn't defined in preset-env's available-plugins.js
file.
This is the merge that fixed the issue: https://github.com/babel/babel/pull/11201/files/a88a00750c61ff89f1622d408d67108719f21ecd
Solution:
- Delete
package-lock.json
oryarn.lock
- Delete
node_modules
folder - In
package.jon
I have adjusted the version numbers of these packages to:
...
"devDependencies": {
"@babel/compat-data": "^7.8.0",
"@babel/preset-env": "^7.8.0",
"babel-loader": "^8.1.0",
...
},
...
"resolutions": {
"@babel/preset-env": "^7.8.0"
}
- Run
npm install
- Run
npm run build
Solution 5:
Reference: https://github.com/angular/angular-cli/issues/17262
I found two solution
a ) Install babel compat
"devDependencies": {
"@babel/compat-data": "7.8.0",
}
b) Install plugin-proposal-numeric-separator
npm install --save-dev @babel/plugin-proposal-numeric-separator
install this version only 7.8.0
-
Angular CLI can create this kind of issue. Go to package json and change it to
build-angular": "0.803.17"
please don't add ^ or ~ .