【问题标题】:This version of CLI is only compatible with Angular versions ^14.0.0此版本的 CLI 仅与 Angular 版本 ^14.0.0 兼容
【发布时间】:2022-11-21 03:37:57
【问题描述】:

我收到以下错误:

This version of CLI is only compatible with Angular versions ^14.0.0,
but Angular version 15.0.0 was found instead.

Please visit the link below to find instructions on how to update Angular.
https://update.angular.io/

我将 Angular 更新为 v15,删除了 node_modules 和 package-lock.json,但仍然出现此错误。

ng v 告诉我版本没问题。 我也将我的构建器改回默认的 "builder": "@angular-devkit/build-angular:browser"

如何解决这个问题?

【问题讨论】:

    标签: angular npm angular-cli


    【解决方案1】:

    你在编译过程中看到任何问题吗?我有同样的问题。在我这边,它发生是因为问题 ngcc ...

    ....
    ....
    - @ng-bootstrap/ng-bootstrap [esm2015/esm2015] (git+https://github.com/ng-bootstrap/ng-bootstrap.git)
    - @ng-bootstrap/ng-bootstrap [main/umd] (git+https://github.com/ng-bootstrap/ng-bootstrap.git)
    - ng-bullet [fesm5/esm5] ()
    - ng-bullet [esm2015/esm2015] ()
    - ng-bullet [esm5/esm5] ()
    - ng-bullet [main/umd] ()
    Warning: Unable to fully load C:/.../node_modules/ng-bullet/bundles/ng-bullet.umd.js for source-map flattening: Cannot read properties of null (reading 'replace')
    Warning: Unable to fully load C:/.../node_modules/ng-bullet/bundles/ng-bullet.umd.js for source-map flattening: Cannot read properties of null (reading 'replace')
    Error: Error when flattening the source-map "C:..../node_modules/ng-bullet/bundles/ng-bullet.umd.js.map" for "C:/.../node_modules/ng-bullet/bundles/ng-bullet.umd.js": TypeError: Cannot read properties of null (reading 'rawMap')
    Encourage the library authors to publish an Ivy distribution.
    
        ng version:
        Package                         Version
        ---------------------------------------------------------
        @angular-devkit/architect       0.1402.10
        @angular-devkit/build-angular   15.0.0
        @angular-devkit/core            15.0.0
        @angular-devkit/schematics      15.0.0
        @schematics/angular             15.0.0
        rxjs                            6.6.0
        typescript                      4.8.4
    

    修复:

    更新角度.json在下面服务

    from:  "builder": "@angular-builders/custom-webpack:dev-server",
    to: "builder": "@angular-devkit/build-angular:dev-server",
    

    【讨论】:

    • 这是因为:@angular-builders/custom-webpack 具有依赖性:“peerDependencies”:{“@angular/compiler-cli”:“^14.0.0”},
    • 需要等待更新来自:@angular-builders/custom-webpack 以支持 angular@xli 15 :(
    猜你喜欢
    • 2022-11-02
    • 2021-06-28
    • 1970-01-01
    • 1970-01-01
    • 2021-12-25
    • 1970-01-01
    • 2019-02-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多