angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

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

Open vegarda opened this issue 6 years ago β€’ 85 comments

🐞 Bug report

Command (mark with an x)

  • [ ] new
  • [x] build
  • [ ] serve
  • [ ] test
  • [ ] e2e
  • [ ] generate
  • [ ] add
  • [ ] update
  • [ ] lint
  • [ ] xi18n
  • [ ] run
  • [ ] config
  • [ ] help
  • [ ] version
  • [ ] doc

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

vegarda avatar Mar 20 '20 21:03 vegarda

I'm working with Yarn 1.22.4 and Angular 8.2.14 on Windows 10. Problem started to occur when I installed ngx-markdown 9.0.0. I had some TypeScript related issue so I downgraded ngx-markdown to 8.2.2. After that I started to get proposal-numeric-separator errors. In my case adding ONLY this...

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

...to the package.json worked. Probably I also removed yarn-lock and node_modules before installing packages once more time (I spent "magic" 1.5h of frustration...). At the same time I "destroyed" my Ubuntu 18.04 VPS . It was working fine on commits before installing ngx-markdown. Nothing was helping - resetting repository to the commit from the past, deleting node_modules, yarn.lock or even upgrading node or yarn versions ;) Looks like when it's broken it's remains broken no matter what you do :P

robertrypula avatar Mar 29 '20 13:03 robertrypula

with me none of previous solutions solved my issue: Just Update Angular-cli in global and also update Node , npm and create another new Project works fine :)

SaraSultanLearn avatar Mar 29 '20 16:03 SaraSultanLearn

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",
    ...
}

worked for me, mac and docker(centos)

phantomk avatar Mar 30 '20 02:03 phantomk

Make sure you hit npm install before rebuilding your app, or the actual version won't be installed

pcaserta avatar Mar 30 '20 19:03 pcaserta

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

Where exactly to add these inside angular.json and package.json? I am a bit new to all this.

Also installing "@babel/compat-data": "7.8.0" did not work for me.

I am using Ionic App

virtualvishwam avatar Mar 30 '20 23:03 virtualvishwam

The following worked for me too:

  1. ADD "@babel/compat-data": "7.8.0" to package.json
  2. CLEAN node_modules
  3. DELETE package-lock.json
  4. RUN npm install
  5. RUN ng build

Code example (from package.json):

{
  "scripts": {
    // no change here
  },
  "dependencies": {
    // no change here
  },
  "devDependencies": {
    "@babel/compat-data": "7.8.0" // added
  }
}

mirogrenda avatar Mar 31 '20 07:03 mirogrenda

All above was not working for me. What I did as a TEMPORARY solution (Hence ugly): npm install install @babel/plugin-proposal-numeric-separator --save-dev

Then changed file (And that is what is ugly, because it won't work if you reinstall modules): node_modules@babel\preset-env\lib\available-lugins.js

By adding: var _pluginProposalNumericSeparator = _interopRequireDefault(require("@babel/plugin-proposal-numeric-separator"));

And at the bottom, in the _default array, adding: "proposal-numeric-separator": _pluginProposalNumericSeparator

Fluuub avatar Mar 31 '20 07:03 Fluuub

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

this did not work for me as well.. but this did..

"devDependencies": { "@babel/core": "^7.7.4", }

vivek437 avatar Mar 31 '20 08:03 vivek437

CICD Use Case

  • I'm building an application on a GitLab instance and deploying to kubernetes.
  • The project is @angular/cli version 7.x.x and I want to use Node.js 12 in my Dockerfile.

I clone the repo to remove the package lock and the node_modules file / folder.

I add this suggestion from above to my package.json then do a quick install to generate a new package-lock.json, and then I modify my Dockerfile. This particular project doesn't require me to compile so I'm doing everything in the Dockerfile.

FROM  custom-registry/nodejs-devops:12-lts_v2.0.0 as node
WORKDIR /app
COPY . .
#################################################
RUN npm install && npx npm-force-resolutions
##################################################
ENV NODE_ENV=production
RUN npm run build

FROM custom-registry/nginx-devops:1.16-lts_v2.0.0
EXPOSE 8080
COPY --from=node /app/dist /usr/share/nginx/html

sethbergman avatar Mar 31 '20 15:03 sethbergman

Can confirm that manually adding "@babel/compat-data": "~7.8.0" to the devDependencies works.

You need to explicitly tell it to use version 7.8.0 (using ~ rather than ^) since any newer versions will not work.

SemicolonStruggles avatar Apr 01 '20 12:04 SemicolonStruggles

For anyone experiencing this issue, Angular CLI 8.3.26 has been released with an update to the babel versions. No workarounds should be necessary after an update. When updating, please ensure that the @angular-devkit/build-angular package was also updated to 0.803.26. This package contains the majority of the build logic for the CLI.

If anyone is still encountering issues after an update, please open a new issue with details regarding your environment and project versions.

clydin avatar Apr 01 '20 22:04 clydin

npm i @babel/[email protected] worked for me. Check the followings as well.

Results of ng --version

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / β–³ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 8.3.25
Node: 10.16.3
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````

SmadusankaB avatar Apr 02 '20 13:04 SmadusankaB

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

works for me too (Y) thanks

UsmanAhmad888 avatar Apr 04 '20 04:04 UsmanAhmad888

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

npm i @babel/[email protected] this worked fine. thanks

devsandro avatar Apr 06 '20 04:04 devsandro

I had the same problem, when building angular app. I just updated my packages and then it worked.

Johan46562 avatar Apr 07 '20 09:04 Johan46562

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.then run your app

https://forum.ionicframework.com/t/how-to-resolve-babel-error-when-installing-geolocation-in-ionic-app/185542/3

anantkumar323 avatar Apr 07 '20 15:04 anantkumar323

I solved this problem as follows:

"devDependencies": {
    "@angular-devkit/architect": "~0.801.2",
    ...

in package.json. then I did npm install to apply the changes.

kaelwebdev avatar Apr 18 '20 01:04 kaelwebdev

got this error while running ng build. Solution

  1. add "@babel/compat-data": "~7.8.0" to devDependencies.
  2. npm install

gokul-ch-pandey avatar Apr 20 '20 10:04 gokul-ch-pandey

got this error while running ng build. Solution

1. add "@babel/compat-data": "~7.8.0" to devDependencies.

2. npm install

Helped me as well.

cvele89 avatar Apr 23 '20 19:04 cvele89

got this error while running ng build. Solution

1. add "@babel/compat-data": "~7.8.0" to devDependencies.

2. npm install

Helped me as well.

Same for me, started experiencing this error after updating an Ionic 4 app to Ionic 5 and building with Ionic Pro. All fine after adding this.

dominic-ks avatar May 23 '20 10:05 dominic-ks