ng build error: Invalid version: "15.2-15.3"
π 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
Literally was coming here to post the exact error. thanks
This comes from browserslist
npx browserslist
and_chr 97
and_ff 95
and_qq 10.4
and_uc 12.12
android 97
baidu 7.12
chrome 97
chrome 96
chrome 95
chrome 94
edge 97
edge 96
firefox 96
firefox 95
firefox 94
firefox 91
firefox 78
ie 11
ios_saf 15.2-15.3
ios_saf 15.0-15.1
ios_saf 14.5-14.8
ios_saf 14.0-14.4
ios_saf 12.2-12.5
kaios 2.5
op_mini all
op_mob 64
opera 82
opera 81
safari 15.2-15.3
safari 15.1
safari 14.1
safari 13.1
samsung 16.0
samsung 15.0
The versions interval comes from here :
ios_saf 15.2-15.3
clearing .browserslistrc makes compilation happy again but this is not a real solution !
This comes from browserslist
npx browserslistand_chr 97 and_ff 95 and_qq 10.4 and_uc 12.12 android 97 baidu 7.12 chrome 97 chrome 96 chrome 95 chrome 94 edge 97 edge 96 firefox 96 firefox 95 firefox 94 firefox 91 firefox 78 ie 11 ios_saf 15.2-15.3 ios_saf 15.0-15.1 ios_saf 14.5-14.8 ios_saf 14.0-14.4 ios_saf 12.2-12.5 kaios 2.5 op_mini all op_mob 64 opera 82 opera 81 safari 15.2-15.3 safari 15.1 safari 14.1 safari 13.1 samsung 16.0 samsung 15.0The versions interval comes from here :
ios_saf 15.2-15.3clearing .browserslistrc makes compilation happy again but this is not a real solution !
works. thanks
Removing content or properly configurating .browserslistrc file fixes it indeed. Thanks @idwebmedia
Removing content or properly configurating .browserslistrc file fixes it indeed. Thanks @idwebmedia
But i mean i want to have the configuration from the Browserlistrc file?
For now the better Solution is to remove Safari:
.browserslistrc
# last 2 Safari major version
This doesn't solve my problem. I am building a library, not an app. The library doesn't have a .browserlistrc file. There's no .browserlistrc in the root folder either. When I run ng build my-library I get the following:
Building Angular Package
------------------------------------------------------------------------------
Building entry point 'my-library'
------------------------------------------------------------------------------
β Compiling with Angular sources in Ivy partial compilation mode.
Transform failed with 1 error:
error: Invalid version: "15.2-15.3"
Any ideas?
@abf7d
add a .browserlistrc with this content to your library
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries
# For the full list of supported browsers by the Angular framework, please see:
# https://angular.io/guide/browser-support
# You can see what browsers were selected by your queries by running:
# npx browserslist
last 1 Chrome version
last 1 Firefox version
Firefox ESR
not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line.
package.json
{
...
"browserslist": [
"and_chr 97",
"and_ff 95",
"and_qq 10.4",
"and_uc 12.12",
"android 97",
"baidu 7.12",
"chrome 97",
"chrome 96",
"chrome 95",
"chrome 94",
"edge 97",
"edge 96",
"firefox 96",
"firefox 95",
"firefox 94",
"firefox 91",
"firefox 78",
"ie 11",
"ios_saf 15.0-15.1",
"ios_saf 14.0-14.4",
"kaios 2.5",
"op_mini all",
"op_mob 64",
"opera 82",
"safari 13.1",
"samsung 16.0",
"samsung 15.0"
],
...
}
This worked for me.
add a
.browserlistrcwith this content to your library
This worked for me. Thanks!
Are you serious, Angular apps cannot run on the newest versions of IOS anymore?
Should it really be an improvement?
I suppose this has passed the internal tests, i.e. deemed fine that Angular apps cannot run on the newest versions of IOS anymore.
I must say, that I totally disagree on that position.
Is this going to remain, because then I must revert to the previous version of Angular.
Is it the official policy of Angular, that going forward support for IOS should be discontinued?
@henrikdahl8240, this is just a bug in the parsing logic of Safari browser versions which needs to be corrected.
We expect browserslist to return an entry for each version ("safari 15.2", "safari 15.3") instead of a range ("safari 15.2-15.3").
This issue is also causing by a change in a transitive dependency which was released over the weekend caniuse-lite which as a result is also causing our (angular-cli) CI to be red.
I should be able to land a fix for this tomorrow.
@alan-agius4 OK. So will it be version 13.2.1 so we can just run update once more?
Yes, once released 13.2.1should contain the fix for this issue.
@alan-agius4 , do you think it may also be released tomorrow or when do you think it may be released?
My real point obviously is, if I should rollback or just wait until tomorrow.
I resolved the problem. Create a file in the root directory with the name ".browserslistrc" and put into it the following content:
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries
# For the full list of supported browsers by the Angular framework, please see:
# https://angular.io/guide/browser-support
# You can see what browsers were selected by your queries by running:
# npx browserslist
last 1 Chrome version
last 1 Firefox version
last 2 Edge major versions
last 2 Safari major versions
last 2 iOS major versions
Firefox ESR
not IE 9-10 # Angular support for IE 9-10 has been deprecated and will be removed as of Angular v11. To opt-in, remove the 'not' prefix on this line.
not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line.
not ios_saf 15.2-15.3
not safari 15.2-15.3
@henrikdahl8240, this is just a bug in the parsing logic of Safari browser versions which needs to be corrected.
We expect browserslist to return an entry for each version (
"safari 15.2", "safari 15.3") instead of a range ("safari 15.2-15.3").This issue is also causing by a change in a transitive dependency which was released over the weekend
caniuse-litewhich as a result is also causing our (angular-cli) CI to be red.I should be able to land a fix for this tomorrow.
ok it seems apple gang flanked and no one knew it could happen. After releasing my app thrut heir playstore process I deemed apple a failed organization. Execs stole all the money and they left nothing to make their R&D ripe. so beware of the apple gang as well.
I resolved the problem. Create a file in the root directory with the name ".browserslistrc" and put into it the following content:
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below. # For additional information regarding the format and rule options, please see: # https://github.com/browserslist/browserslist#queries # For the full list of supported browsers by the Angular framework, please see: # https://angular.io/guide/browser-support # You can see what browsers were selected by your queries by running: # npx browserslist last 1 Chrome version last 1 Firefox version last 2 Edge major versions last 2 Safari major versions last 2 iOS major versions Firefox ESR not IE 9-10 # Angular support for IE 9-10 has been deprecated and will be removed as of Angular v11. To opt-in, remove the 'not' prefix on this line. not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line. not ios_saf 15.2-15.3 not safari 15.2-15.3
this solutions did not work for my nx/angular
thanks for trying
my suggestion is to roll it back all fluff no stuff and no huff
re-think what the ground conditions are and proceed with caution
simple
if you can create an nx project and run nx report and compile an nx project... that should be a flag ship unit test
regular expressions are fairly fail safe if modeled properly... bulletproof any version logic should rightfully be using regular expressions just another helpful suggestion if you have any snippets Im happy to assist
@alan-agius4
Yes, once released
13.2.1should contain the fix for this issue.
It should be fixed in Angular 12 too.
Thank you.