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

ng build error: Invalid version: "15.2-15.3"

Open shakeri opened this issue 4 years ago β€’ 78 comments

🐞 Bug report

Command (mark with an x)

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

Description

When i build project with Angular CLI, I get this error:

An unhandled exception occurred: Transform failed with 1 error: error: Invalid version: "15.2-15.3" See "C:\Users\MOHAMM~1\AppData\Local\Temp\ng-JBqIfM\angular-errors.log" for further details.

And in angular-errors.log file:

[error] HookWebpackError: Transform failed with 1 error:
error: Invalid version: "15.2-15.3"
    at makeWebpackError (E:\workingfolder\test-app\node_modules\webpack\lib\HookWebpackError.js:48:9)
    at E:\workingfolder\test-app\node_modules\webpack\lib\Compilation.js:3057:12
    at eval (eval at create (E:\workingfolder\test-app\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:98:1)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
-- inner error --
Error: Transform failed with 1 error:
error: Invalid version: "15.2-15.3"
    at failureErrorWithLog (E:\workingfolder\test-app\node_modules\@angular-devkit\build-angular\node_modules\esbuild\lib\main.js:1557:15)
    at E:\workingfolder\test-app\node_modules\@angular-devkit\build-angular\node_modules\esbuild\lib\main.js:1346:29
    at E:\workingfolder\test-app\node_modules\@angular-devkit\build-angular\node_modules\esbuild\lib\main.js:637:9
    at handleIncomingPacket (E:\workingfolder\test-app\node_modules\@angular-devkit\build-angular\node_modules\esbuild\lib\main.js:734:9)
    at Socket.readFromStdout (E:\workingfolder\test-app\node_modules\@angular-devkit\build-angular\node_modules\esbuild\lib\main.js:604:7)
    at Socket.emit (node:events:390:28)
    at addChunk (node:internal/streams/readable:315:12)
    at readableAddChunk (node:internal/streams/readable:289:9)
    at Socket.Readable.push (node:internal/streams/readable:228:10)
    at Pipe.onStreamRead (node:internal/stream_base_commons:199:23)

🌍 Your Environment



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


Angular CLI: 13.2.0
Node: 16.13.2
Package Manager: npm 8.4.0
OS: win32 x64

Angular: 13.2.0
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1302.0
@angular-devkit/build-angular   13.2.0
@angular-devkit/core            13.2.0
@angular-devkit/schematics      13.2.0
@schematics/angular             13.2.0
rxjs                            7.5.2
typescript                      4.5.5

shakeri avatar Jan 29 '22 20:01 shakeri

This workaround seems to work:

npm install [email protected] --save-dev --save-exact

If don't, add to npm overrides or yarn resolutions.

mshima avatar Jan 31 '22 09:01 mshima

To resolve the issue , edit the browser list on Package.json file , the browserlistrc file isn't taken into consideration.

and use a configuration that explicitly specifies not to build for these Browser versions , like this one : "browserslist": [ "android 97", "chrome 97", "chrome 96", "chrome 95", "chrome 94", "edge 97", "edge 96", "firefox 96", "firefox 95", "firefox 94", "firefox 91", "firefox 78", "ios_saf 15.0-15.1", "ios_saf 14.0-14.4", "kaios 2.5", "opera 82", "safari 13.1", "samsung 16.0", "samsung 15.0" ]

You can verify if the modification is taken into account by running the following command : npx browserslist

otmos avatar Jan 31 '22 10:01 otmos

@abadakhshan, the fix will also be back ported to version 12.

alan-agius4 avatar Jan 31 '22 10:01 alan-agius4

Had the same issue, using Angular v.13.1.1. Removing the line "last 2 Safari major versions" from the file .browserslistrc fixed this issue for me.

veronika-prokopiv avatar Jan 31 '22 11:01 veronika-prokopiv

Also seeing this issue Angular 12

JKennedy24 avatar Jan 31 '22 14:01 JKennedy24

This workaround seems to work:

npm install [email protected] --save-dev --save-exact

If don't, add to npm overrides or yarn resolutions.

Having this error after using this workaround image

GregoireLgt avatar Jan 31 '22 14:01 GregoireLgt

Facing same issue in Angular 12 @alan-agius4

Edit: Working fine after updating to v12.2.16

Shan7anu avatar Jan 31 '22 14:01 Shan7anu

Fix is merged and we're triggering a release now, should be out soon.

dgp1130 avatar Jan 31 '22 17:01 dgp1130

This is fixed in v12.2.16 and v13.2.1, please update if you are experiencing this issue. Users on v11 shouldn't be affected.

dgp1130 avatar Jan 31 '22 18:01 dgp1130

ok this looks good now... thank you for the response to this

nx is building

MEANSTACKDIGITAL avatar Jan 31 '22 23:01 MEANSTACKDIGITAL

This is fixed in v12.2.16 and v13.2.1, please update if you are experiencing this issue. Users on v11 shouldn't be affected.

I do also have to problem in v13.1.x do I need to upgrade to v13.2.x or will it also be fixed in this version

sass1997 avatar Feb 01 '22 07:02 sass1997

@sass1997, you will need to update to 13.2.1.

alan-agius4 avatar Feb 01 '22 07:02 alan-agius4

I have updated to 13.2.1 but still got this error. (Nx repo maybe also an existing error there?)

gkTim avatar Feb 01 '22 08:02 gkTim

@gkTim How have you got 13.2.1 because as I look at https://www.npmjs.com/search?q=%40angular%2Fcore I still get only 13.2.0 as the latest version?

henrikdahl8240 avatar Feb 01 '22 08:02 henrikdahl8240

@henrikdahl8240 okay maybe it is currently not available. I thought it is about the angular-cli package and this is available in version 13.2.1

gkTim avatar Feb 01 '22 08:02 gkTim

@gkTim , yes, since yesterday evening, Danish time, but it is not.

henrikdahl8240 avatar Feb 01 '22 08:02 henrikdahl8240

You need to update @angular/cli and @angular-devkit/build-angular to version 13.2.1 and not @angular/core.

You can run the below command:

ng update @angular/cli

If you also have library projects in your Angular workspace, make sure to update ng-packagr to version 13.2.1.

alan-agius4 avatar Feb 01 '22 09:02 alan-agius4

@alan-agius4 what about if we are running angular 12? Running the command ng update @angular/cli pushed all my libs up to angular 13. But we need to stay on 12

JKennedy24 avatar Feb 01 '22 09:02 JKennedy24

@JKennedy24 Perhaps you should have used @angular/cli@TheVersionYouPreferred?

henrikdahl8240 avatar Feb 01 '22 09:02 henrikdahl8240

For anyone using NX it's tracked here: https://github.com/nrwl/nx/issues/8768

t-ricci-delta avatar Feb 01 '22 09:02 t-ricci-delta