安装AngularUnsupportedEngine,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 日

NPM7.5.6或更大的现在与angular-cli版本9.1.1510.2.311.2.212.0.0-next.2或更大的(每个主要版本内)本意见从角队

原始消息 - 2021 年 2 月 7 日

angular-cli根据此 GitHub 问题,截至撰写本文时,npm 7 并未完全受支持

我也在 Windows 上收到相同的警告 current: { node: 'v15.4.0', npm: '7.5.2' }

当我ng new使用 npm 7运行时,Angular CLI 会返回警告并提供解决方法

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 最近于 2021 年 2 月 2 日正式发布

这是一个持续存在的问题,npm 团队最近添加了一条评论,以回应 Angular 团队对上述 GitHub 问题的回应。


回答

这个问题是因为 npm 版本

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

  • 节点:'>= 10.13.0' angular cli 需要大于或等于 10.13.0 的版本
  • npm: '^6.11.0' 此处插入符号 (^) 表示“与版本兼容” 6.11 并且您有一个版本 7.5.2

查看此帖子以了解有关 ^ 或 ~ 等 npm 符号的更多信息

您所要做的就是安装兼容版本

sudo npm i -g npm@6.11.0


以上是安装AngularUnsupportedEngine,OSX的全部内容。
THE END
分享
二维码
< <上一篇
下一篇>>