安装 Angular 不支持的引擎,OSX

Install Angular Unsupported Engine, OSX

我正在重新安装我的 MacBook。我在安装 (npm install -g @angular/cli) angular 时收到以下消息。知道为什么吗?我怀疑是 nom 版本,但我使用的是 node...

Developments npm install -g @angular/cli
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '@angular/cli@11.1.4',
npm WARN EBADENGINE   required: { node: '>= 10.13.0', npm: '^6.11.0', yarn: '>= 1.13.0' },
npm WARN EBADENGINE   current: { node: 'v15.8.0', npm: '7.5.2' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '@angular-devkit/architect@0.1101.4',
npm WARN EBADENGINE   required: { node: '>= 10.13.0', npm: '^6.11.0', yarn: '>= 1.13.0' },
npm WARN EBADENGINE   current: { node: 'v15.8.0', npm: '7.5.2' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '@angular-devkit/core@11.1.4',
npm WARN EBADENGINE   required: { node: '>= 10.13.0', npm: '^6.11.0', yarn: '>= 1.13.0' },
npm WARN EBADENGINE   current: { node: 'v15.8.0', npm: '7.5.2' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '@angular-devkit/schematics@11.1.4',
npm WARN EBADENGINE   required: { node: '>= 10.13.0', npm: '^6.11.0', yarn: '>= 1.13.0' },
npm WARN EBADENGINE   current: { node: 'v15.8.0', npm: '7.5.2' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '@schematics/angular@11.1.4',
npm WARN EBADENGINE   required: { node: '>= 10.13.0', npm: '^6.11.0', yarn: '>= 1.13.0' },
npm WARN EBADENGINE   current: { node: 'v15.8.0', npm: '7.5.2' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '@schematics/update@0.1101.4',
npm WARN EBADENGINE   required: { node: '>= 10.13.0', npm: '^6.11.0', yarn: '>= 1.13.0' },
npm WARN EBADENGINE   current: { node: 'v15.8.0', npm: '7.5.2' }
npm WARN EBADENGINE }
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142

    added 241 packages, and audited 242 packages in 12s
    
    20 packages are looking for funding
      run `npm fund` for details
    
    found 0 vulnerabilities

更新 - 2021 年 2 月 25 日

npm 7.5.6 或更高版本现在适用于 angular-cli 版本 9.1.1510.2.311.2.212.0.0-next.2 或更高版本 (在每个主要版本中) 根据来自 Angular 团队 Angularthis comment

原始消息 - 2021 年 2 月 7 日

根据 this GitHub issue

angular-cli 不完全支持 npm 7

我在 Windows 和 current: { node: 'v15.4.0', npm: '7.5.2' }

上也收到相同的警告

Angular CLI returns 当我 运行 ng new 使用 npm 7 时发出警告并提供解决方法

npm version 7.5.2 detected.
The Angular CLI currently requires npm version 6.

Please install a compatible version to proceed (`npm install --global npm@6`).

npm 7 was made generally available very recently on 2nd Feb 2021

这是一个持续存在的问题,npm 团队最近 added a comment 回应了 Angular 团队对上述 GitHub 问题的回应。

这个问题是因为npm版本

npm WARN EBADENGINE 需要:{ node: '>= 10.13.0', npm: '^6.11.0', yarn: '>= 1.13.0' }

  • node: '>= 10.13.0' angular cli 要求版本大于或等于 10.13.0
  • npm: '^6.11.0' 这里的插入符号 (^) 表示“与版本兼容” 6.11 并且你有一个版本 7.5.2

check this post 以了解有关 npm 符号的更多信息,例如 ^ 或 ~

您只需安装兼容版本

sudo npm i -g npm@6.11.0

就我而言,升级到较新的 angular-devkit 解决了问题。

现在我正在使用:Angular 11.2.6 和 npm 7.6.3

"devDependencies": {
        "@angular-devkit/build-angular": "^0.1102.5",
    ...

我遇到了同样的问题。它正在与:

升级 npm 版本

npm install -g npm@7.22.0

检查当前版本