Skip to content

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

Closed
Exac/mark4
#2

Description

@shakeri

🐞 Bug report

Command (mark with an x)

  • new
  • 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

Activity

  1. idwebmedia commented on Jan 29, 2022

    @idwebmedia

    Literally was coming here to post the exact error. thanks

  2. jmbarbier commented on Jan 29, 2022

    @jmbarbier

    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 !

  3. idwebmedia commented on Jan 29, 2022

    @idwebmedia

    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 !

    works. thanks

  4. cvandradg commented on Jan 30, 2022

    @cvandradg

    Removing content or properly configurating .browserslistrc file fixes it indeed. Thanks @idwebmedia

  5. modified the milestone: needsTriage on Jan 30, 2022
  6. modified the milestones: needsTriage, Backlog on Jan 30, 2022
  7. self-assigned this
    on Jan 30, 2022
  8. 88 remaining items

  9. alessiostalla commented on Mar 16, 2022

    @alessiostalla

    I'm using Angular 13.2.6 and still have the problem in our CI build (not locally, though).

  10. chalkplum commented on Mar 16, 2022

    @chalkplum

    I still get this error 13.1.4 with range in browserlist

    Angular CLI: 13.1.4
    Node: 16.13.0
    Package Manager: npm 8.1.4
    OS: win32 x64

    Angular: 13.1.3
    ... animations, common, compiler, compiler-cli, core, forms
    ... platform-browser, platform-browser-dynamic, router
    ... service-worker

    Package Version

    @angular-devkit/architect 0.1301.4
    @angular-devkit/build-angular 13.1.4
    @angular-devkit/core 13.1.4
    @angular-devkit/schematics 13.1.4
    @angular/cdk 13.2.6
    @angular/cli 13.1.4
    @schematics/angular 13.1.4
    rxjs 7.4.0
    typescript 4.5.5

    i cant go above as i have peer dependency, nice update there i will have to roll back angular to lower version as was ok there,

  11. added a commit that references this issue on Mar 23, 2022
  12. TomCosta commented on Mar 30, 2022

    @TomCosta

    I have solved that by doing:

    ng update @angular/core @angular/cli
    ng update
    

    Hope it helps.

  13. alessiostalla commented on Mar 30, 2022

    @alessiostalla

    I have solved that by doing:

    ng update @angular/core @angular/cli
    ng update
    

    Hope it helps.

    Didn't work for me

  14. added a commit that references this issue on Apr 3, 2022
  15. hoeni commented on Apr 4, 2022

    @hoeni

    I had to remove every line resolving to a safari browser from my browserslist to make the build work again. This also means removing lines lie >1% in de.

  16. strarsis commented on Apr 6, 2022

    @strarsis

    My approach for a starter project I used (unfamiliar to me):

    grep -R 'last 2 Safari major' .

    ./node_modules/@angular-devkit/build-angular/src/utils/supported-browsers.js:        'last 2 Safari major versions',
    ./node_modules/@schematics/angular/library/files/.browserslistrc.template:last 2 Safari major versions
    ./node_modules/@schematics/angular/application/files/.browserslistrc.template:last 2 Safari major versions
    

    npm ls @angular-devkit/build-angular

    [...]
    └── @angular-devkit/[email protected]
    

    npm ls @schematics/angular

    [...]
    └─┬ @angular/[email protected]
      └── @schematics/[email protected]
    

    (Using david, a npm package update checker
    (install it using npm install -g david / yarn global add david)).

    david | grep @angular-devkit/build-angular

    │ @angular-devkit/build-angular │ ~13.1.0  │ 13.3.2  │
    

    npm install --legacy-peer-deps --save @angular-devkit/[email protected]

    david | grep @angular/cli

    │ @angular/cli                  │ ~13.1.0  │ 13.3.2  │
    

    npm install --legacy-peer-deps --save-dev @angular/[email protected]

    Luckily these updates were enough to also update the browser support configurations in the affected dependencies.

  17. chamikasandamal commented on Apr 21, 2022

    @chamikasandamal

    run npm audit fix --force or update @angular-devkit/build-angular

  18. leonardo-nicolas commented on Apr 23, 2022

    @leonardo-nicolas

    run npm audit fix --force or update @angular-devkit/build-angular

    I tried run this command, but I had unsuccessful.

  19. added a commit that references this issue on Apr 24, 2022
  20. martinmolema commented on May 4, 2022

    @martinmolema

    ng update @angular/core @angular/cli

    First updated to Angular using npm install -g @angular/cli outside the project folder.

    Angular CLI: 13.3.4
    Node: 14.17.5
    Package Manager: npm 8.3.0
    OS: linux x64
    
    Angular: 
    ... 
    
    Package                      Version
    ------------------------------------------------------
    @angular-devkit/architect    0.1303.4 (cli-only)
    @angular-devkit/core         13.3.4 (cli-only)
    @angular-devkit/schematics   13.3.4 (cli-only)
    @schematics/angular          13.3.4 (cli-only)
    

    Then in my project:
    Had to remove the node_modules and package-lock.json after updating the version numbers. After that ran npm install again and all is working now.

    In my package.json:

      "dependencies": {
        "@angular/animations": "~13.3.5",
        "@angular/cdk": "^13.3.4",
        "@angular/common": "~13.3.5",
        "@angular/compiler": "~13.3.5",
        "@angular/core": "~13.3.5",
        "@angular/forms": "~13.3.5",
        "@angular/material": "^13.3.4",
        "@angular/material-moment-adapter": "^13.3.4",
        "@angular/platform-browser": "~13.3.5",
        "@angular/platform-browser-dynamic": "~13.3.5",
        "@angular/router": "~13.3.5",
    
    

    I do not have a .browserslistrc in my project folder

  21. angular-automatic-lock-bot commented on Jun 4, 2022

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  22. locked and limited conversation to collaborators on Jun 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions