angular / angular-cli

CLI tool for Angular
https://cli.angular.io
MIT License
26.76k stars 11.98k forks source link

Error | Could not find plugin "proposal-numeric-separator" | Generating ES5 bundles for differential loading #17262

Closed vegarda closed 4 years ago

vegarda commented 4 years ago

🐞 Bug report

Command (mark with an x)

Is this a regression?

Yes, the previous version in which this bug was not present was: a few hours ago ### Description A clear and concise description of the problem... Build doesn't work ## πŸ”¬ Minimal Reproduction

npm install
node --max-old-space-size=4096 ./node_modules/@angular/cli/bin/ng build --prod

πŸ”₯ Exception or Error



Generating ES5 bundles for differential loading...
An unhandled exception occurred: [BABEL] C:\angular\dist\common-es2015.b1722ef05b43f664abc2.js: Could not find plugin "proposal-numeric-separator". Ensure there is an entry in ./available-plugins.js for it. (While processing: "C:\\angular\\node_modules\\@angular-devkit\\build-angular\\node_modules\\@babel\\preset-env\\lib\\index.js")
See "C:\Users\Vegard\AppData\Local\Temp\ng-J7YoSB\angular-errors.log" for further details.

🌍 Your Environment


Angular CLI: 8.3.25
Node: 12.14.1
OS: win32 x64
Angular: 8.2.14
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic
... platform-webworker, platform-webworker-dynamic, router
... service-worker

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.803.25
@angular-devkit/build-angular     0.803.25
@angular-devkit/build-optimizer   0.803.25
@angular-devkit/build-webpack     0.803.25
@angular-devkit/core              8.3.25
@angular-devkit/schematics        8.3.25
@angular/cdk                      8.2.3
@angular/cli                      8.3.25
@angular/material                 8.2.3
@angular/pwa                      0.803.25
@ngtools/webpack                  8.3.25
@schematics/angular               8.3.25
@schematics/update                0.803.25
rxjs                              6.5.4
typescript                        3.5.3
webpack                           4.39.2



Anything else relevant?

https://github.com/facebook/create-react-app/issues/8680

keitoaino commented 4 years ago

Try to install "@babel/compat-data": "~7.8.0" to devDependencies. This is the only workaround which helped me.

dex252 commented 4 years ago

Try to install "@babel/compat-data": "~7.8.0" to devDependencies. This is the only workaround which helped me.

This is don't work for me...

azhukov87 commented 4 years ago

Hi, all @vegarda, @dex252 I have the issue as well, but i managed to find single working set of package(s)

"@angular-devkit/build-angular": "^0.803.23", "@angular/cli": "~8.3.22",

I believe the you need to use lower version of @angular-devkit/build-angular rather then 0.803.25

vegarda commented 4 years ago

I was able to build by disabling generating ES5 bundles for differential loading by setting

"browserslist": [
    "last 2 Chrome versions"
]

in packages.json, and

"es5BrowserSupport": false

in angular.json

mattcwebster commented 4 years ago

Try to install "@babel/compat-data": "~7.8.0" to devDependencies. This is the only workaround which helped me.

This also worked for me. I was getting this error when building an image for an Angular 8 Universal app with docker. I also followed the steps listed in this react thread to use npm resolutions. https://github.com/facebook/create-react-app/issues/8680. Not sure if the resolutions step is needed because it wasn't until I added @babel/compat-data to my devDependencies that the issue was resolved. I would first just try adding @babel/compat-data to devDependencies.

judedaryl commented 4 years ago

Try to install "@babel/compat-data": "~7.8.0" to devDependencies. This is the only workaround which helped me.

This also worked for me. I want to add that the error didn't show up locally, but only when i used Azure Devops. I think DevOps bumps up the babel versions

OyebisiJemil commented 4 years ago

"@babel/compat-data": "~7.8.0"

this(npm i @babel/compat-data@7.8.0) works for me! thanks @keitoaino

SergeyMell commented 4 years ago

"@babel/compat-data": "~7.8.0"

This also worked for me. Be sure to use exactly this version. Pay attention to the version. Firstly I automatically installed "@babel/compat-data": "^7.9.0" - this didn't work

keitoaino commented 4 years ago

@judedaryl this could be also related to package-lock.json - if it's ignored (eg using npm i instead of npm ci) then remote CI could be affected by this issue.

farajfarook commented 4 years ago

just installing "@babel/compat-data": "7.8.0" didn't work for me. I had to delete the package-lock.json file

Try to install "@babel/compat-data": "~7.8.0" to devDependencies. This is the only workaround which helped me.

This is don't work for me...

ghost commented 4 years ago

Sticking to previous version of build-angular just do the work without any other change (and "@babel/compat-data": "7.8.0" did not work for me, with or without removing the lock)

"devDependencies": {
    "@angular-devkit/build-angular": "=0.803.22",
    ...
}
maurimorinelli commented 4 years ago

Try to install "@babel/compat-data": "~7.8.0" to devDependencies. This is the only workaround which helped me.

This worked for me. Is this considered a temporary solution? Should we keep a watch on this and remove it later?

zraees commented 4 years ago

Try to install "@babel/compat-data": "~7.8.0" to devDependencies. This is the only workaround which helped me.

Rocks!

nchakravarthi commented 4 years ago

Try to install "@babel/compat-data": "~7.8.0" to devDependencies. This is the only workaround which helped me.

Worked for me!! Do we need to remove it manually after the fix or will be handled in the internal devDependencies?

keitoaino commented 4 years ago

@morinellipy @gs-nchakravarthi yes, we need to keep this only until issue will be fixed. Then it will be needed to remove @babel/compat-data dependency from host website and update @angular-devkit/build-angular (see https://github.com/angular/angular-cli/pull/17267)

gustavohks2 commented 4 years ago

"@babel/compat-data": "~7.8.0" suggestion from the comment above solved the problem. I believe it will be fixed soon since the issue has been reported yesterday.

vajidaliji commented 4 years ago

"@babel/compat-data": "~7.8.0"

this(npm i @babel/compat-data@7.8.0) works for me! thanks @keitoaino

Thanks men this is also work for me

Roman-Lo commented 4 years ago

Try to install "@babel/compat-data": "~7.8.0" to devDependencies. This is the only workaround which helped me.

This also worked for me. I was getting this error when building an image for an Angular 8 Universal app with docker. I also followed the steps listed in this react thread to use npm resolutions. facebook/create-react-app#8680. Not sure if the resolutions step is needed because it wasn't until I added @babel/compat-data to my devDependencies that the issue was resolved. I would first just try adding @babel/compat-data to devDependencies.

I'm using nrwl workspace with angular@^8.2.0(the angular cli version is 8.3.14 in the yarn.lock) and I having the same issue.

I've tried all the work arounds under this thread and none of them works for me, not until I tried adding resolutions in my package.json file.

"resolutions": {
    "@babel/preset-env": "^7.8.7"
},

See: create-react-app Issue #8860

I hope this will help someone who still having issue after trying all above, like me. And I'm looking forward for the fix.

lchiesa2000 commented 4 years ago

The problem is preseent also with angular 8 [INFO] Generating ES5 bundles for differential loading... [INFO] An unhandled exception occurred: [BABEL] /var/lib/jenkins/workspace/dgkoro1_0/dg-suite-client/dist/dg-suite/polyfills-es5.42ee81f782be21ac5c8b.js: Could not find plugin "proposal-numeric-separator". Ensure there is an entry in ./available-plugins.js for it. (While processing: "/var/lib/jenkins/workspace/dgkoro1_0/dg-suite-client/node_modules/@babel/preset-env/lib/index.js") [INFO] See "/tmp/ng-QZa8t9/angular-errors.log" for further details. [INFO] npm ERR! code ELIFECYCLE [INFO] npm ERR! syscall spawn [INFO] npm ERR! file sh [INFO] npm ERR! errno ENOENT [INFO] npm ERR! dg-suite@0.0.0 build-svil: ng build --configuration=svil && node usestrictfixer.js [INFO] npm ERR! spawn ENOENT [INFO] npm ERR! [INFO] npm ERR! Failed at the dg-suite@0.0.0 build-svil script. [INFO] npm ERR! This is probably not a problem with npm. There is likely additional logging output above. [INFO] [INFO] npm ERR! A complete log of this run can be found in: [INFO] npm ERR! /var/lib/jenkins/.npm/_logs/2020-03-23T07_48_51_372Z-debug.log

lakshitha1629 commented 4 years ago

Use these Steps to Fix the Issue

  1. delete node_modules and package-lock.json

  2. add "resolutions": { "@babel/preset-env": "^7.8.7" } to package.json

  3. npm install npm-force-resolutions --save-dev

  4. npm install

  5. npx npm-force-resolutions

  6. npm install again

  7. ionic build , ionic cordova run android

alexnoise79 commented 4 years ago

CHANGING "@angular-devkit/build-angular": "^0.803.25" TO "@angular-devkit/build-angular": "0.803.23"

worked for me

mohanramphp commented 4 years ago

Try to install "@babel/compat-data": "~7.8.0" to devDependencies. This is the only workaround which helped me.

Thank god. This works. Angular Team please help in fixing this issue from angular cli end.

splincode commented 4 years ago

working

"@babel/compat-data": "7.8.0"

not working

"@babel/compat-data": "7.9.0"
kkilton commented 4 years ago

Verified that it was a Babel bug introduced 3 days ago. https://github.com/babel/babel/pull/11201 https://www.npmjs.com/package/@babel/preset-env Lock down the versions of Babel’s packages using the tilde instead of the caret: "dependencies": { "@babel/preset-env": "~7.8.7", "@babel/compat-data": "~7.8.6",

ghost commented 4 years ago

Hi kkilton, may I ask you how to do this lockdown? Is it equivalent procedure than the one given by Lakshitha Perera but for preset-env and compat-data ?

kkilton commented 4 years ago

Hi kkilton, may I ask you how to do this lockdown? Is it equivalent procedure than the one given by Lakshitha Perera but for preset-env and compat-data ?

stchln, I didn't need to do all the extra steps that Lakshitha did (although I tried and it didn't work for me) I just updated the dependencies in the package.config. The tilde's are what's important. The caret will allow the versions to go up to minor 7.9.999 (which is where the problem is, minor version 9) where the tilde only allows the patch version to increase up to 7.8.999... You could also remove the tilde and caret completely until Babel gets a fix deployed. Hope this helps.

ghost commented 4 years ago

Will try, thanks a lot

Ruslancic commented 4 years ago

Try to install "@babel/compat-data": "~7.8.0" to devDependencies. This is the only workaround which helped me.

This procedure, break the compilation of es5 files in ionic for old webview system and older phone! Resulting in Blank White Screen! screenshot_725

NewtonMan commented 4 years ago

WORKARROUND On package.json add

  "resolutions": {
    "@babel/preset-env": "^7.8.7",
    "@babel/compat-data": "~7.8.0"
  }

run npx npm-force-resolutions then run npm install or yarn then run npm build or yarn build

jazarie2 commented 4 years ago

WORKARROUND On package.json add

  "resolutions": {
    "@babel/preset-env": "^7.8.7",
    "@babel/compat-data": "~7.8.0"
  }

run npx npm-force-resolutions then run npm install or yarn then run npm build or yarn build

Tried this and work on first try

ghost commented 4 years ago

This is not working for me, I still have the painful error on @babel/plugin-proposal-numeric-separator while in my package-lock.json I see compat-data 7.8.6 and preset-env 7.8.7

npm ls @babel/preset-env gives visual@ c:... β€” @babel/preset-env@7.8.7

npm ls @babel/compat-data visual@ ... +β€” @babel/compat-data@7.8.6 Λ‹β€” @babel/preset-env@7.8.7 +β€” @babel/compat-data@7.8.6 deduped Β΄β€” @babel/helper-compilation-target@7.8.7 Β΄@babel/compat-data@7.8.6

ghost commented 4 years ago

@jazarie2 just tried what you suggest and I can go up to npm build, thanks but then when, as sampleRHTMLVisual demo I am trying to build, I am requested to have @babel/plugin-proposal-numeric-separator when launching pbiviz package...

ghost commented 4 years ago

And If I do a npm install β€”save-dev @babel/plugin-proposal-numeric-separator I get a warning that the plugin required a peer of @babel/core@^7.0.0-0 but none is installed

kkilton commented 4 years ago

@stchln can you try and delete your node_module/@babel folder and then run npm install? I went down the route of trying to install the proposal-numeric-separator but ended up reverting that and didn't need it in the end. Your package-lock.json looks fine from the ls cmd but maybe try and delete it and re-gen it with npm install --package-lock?

MustafaMohamed2018 commented 4 years ago

working

"@babel/compat-data": "7.8.0"

not working

"@babel/compat-data": "7.9.0"

that worked for me thanks

datazen commented 4 years ago

WORKARROUND On package.json add

  "resolutions": {
    "@babel/preset-env": "^7.8.7",
    "@babel/compat-data": "~7.8.0"
  }

run npx npm-force-resolutions then run npm install or yarn then run npm build or yarn build

Tried this and also worked on first try

lopezbertoni commented 4 years ago

Same here

working

"@babel/compat-data": "7.8.0"

not working

"@babel/compat-data": "7.9.0"

that worked for me thanks

burdokat commented 4 years ago

CHANGING "@angular-devkit/build-angular": "^0.803.25" TO "@angular-devkit/build-angular": "0.803.23"

worked for me

This worked for me. No problem with angular ng build.

willr79 commented 4 years ago

WORKARROUND On package.json add

  "resolutions": {
    "@babel/preset-env": "^7.8.7",
    "@babel/compat-data": "~7.8.0"
  }

run npx npm-force-resolutions then run npm install or yarn then run npm build or yarn build

This also worked for me on the first try. Thank you for the solution!

fritzwf commented 4 years ago

The above "WORKARROUND" worked for me.

devexpert9 commented 4 years ago

Try this, this works: npm i @babel/compat-data@7.8.0

ghost commented 4 years ago

DONE compiled pbiviz after applying the « resolutions » from datazen + manual installation of @babel/plugin-proposal-numeric-separator Thanks all

WahabShah23 commented 4 years ago

Try this, this works: npm i @babel/compat-data@7.8.0

This worked for me as well. Tried all others but this was the one successfully executed. Have been banging my head from past 6-7 hours before landed here. Thank you.

astaev commented 4 years ago

@babel/comap-data didn't help on my machine. Manually referencing the numeric-separator package into the @babel/preset-env/lib/available-plugins.js fixed the error. var _pluginNumeric = _interopRequireDefault(require("@babel/plugin-proposal-numeric-separator")); "proposal-numeric-separator": _pluginNumeric.default,

vigan-abd commented 4 years ago

Hi, all @vegarda, @dex252 I have the issue as well, but i managed to find single working set of package(s)

"@angular-devkit/build-angular": "^0.803.23", "@angular/cli": "~8.3.22",

I believe the you need to use lower version of @angular-devkit/build-angular rather then 0.803.25

Forcing version of "@angular-devkit/build-angular" to 0.803.22 fixed the issue also in my env, "@babel/compat-data": "~7.8.0" didn't work

okandavut commented 4 years ago

Try to install "@babel/compat-data": "~7.8.0" to devDependencies. This is the only workaround which helped me.

It's also worked for me thanks!

pixael commented 4 years ago

I only had to do: npm i @babel/compat-data@7.8.0 works like a charm. Thanks to @keitoaino.

efernpe commented 4 years ago

Try to install "@babel/compat-data": "~7.8.0" to devDependencies. This is the only workaround which helped me.

This worked to me.

Angular CLI: 8.3.25 Node: 12.16.1 OS: linux x64 Angular: 8.2.14

@angular-devkit/architect 0.803.25 @angular-devkit/build-angular 0.803.25 @angular-devkit/build-optimizer 0.803.25 @angular-devkit/build-webpack 0.803.25 @angular-devkit/core 8.3.25 @angular-devkit/schematics 8.3.25 @angular/cli 8.3.25 @ngtools/webpack 8.3.25 @schematics/angular 8.3.25 @schematics/update 0.803.25 rxjs 6.4.0 typescript 3.5.3 webpack 4.39.2

haoolii commented 4 years ago

I remove whole node_modules which installed with ng new, and run npm install again.

Angular CLI: 8.3.25
Node: 10.17.0
OS: win32 x64
Angular: 8.2.14
... animations, common, compiler, compiler-cli, core, forms     
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.803.25
@angular-devkit/build-angular     0.803.25
@angular-devkit/build-optimizer   0.803.25
@angular-devkit/build-webpack     0.803.25
@angular-devkit/core              8.3.25
@angular-devkit/schematics        8.3.25
@angular/cli                      8.3.25
@ngtools/webpack                  8.3.25
@schematics/angular               8.3.25
@schematics/update                0.803.25
rxjs                              6.4.0
typescript                        3.5.3
webpack                           4.39.2
adiediekdo commented 4 years ago

"@babel/compat-data": "~7.8.0"

this(npm i @babel/compat-data@7.8.0) works for me! thanks @keitoaino

works for me to, thanks