【问题标题】:Install Angular Unsupported Engine, OSX安装 Angular 不支持的引擎,OSX
【发布时间】:2021-05-11 06:44:27
【问题描述】:

我正在重新安装我的 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

【问题讨论】:

    标签: node.js macos npm angular-cli npm-install


    【解决方案1】:

    更新 - 2021 年 2 月 25 日

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

    原始消息 - 2021 年 2 月 7 日

    根据this GitHub issueangular-cli 不完全支持 npm 7

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

    当我使用 npm 7 运行 ng new 并提供解决方法时,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 was made generally available very recently on 2nd Feb 2021

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

    【讨论】:

    • 那么,我应该降级Node/Npm的版本吗?
    • 不要认为有必要降级节点。如果您现在需要解决方法来使用 ng,那么您可以按照错误消息说明尝试将 npm 降级到版本 6 npm install --global npm@6。但是您可能想订阅GitHub issue 以查看将来是否有任何与 npm 7 兼容的解决方法或修复。
    • 更新:npm 7.5.6 应该在即将发布的版本中与 angular-cli 一起使用。 Angular 团队已在此 PR 中对 “删除 npm 7 不兼容通知” 进行了更改,在撰写本文时已合并到 master 但尚未发布。新版angular-cli 发布后,我将编辑并更新我的答案。
    • 降级 npm 对我有用。使用以下命令: npm install --global npm@6.14.16
    【解决方案2】:

    日期:2021/09/03

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

    升级 npm 版本

    npm install -g npm@7.22.0
    

    查看当前版本

    【讨论】:

    • 我认为npm的最后一个小版本是v7.24.2
    • 是的,我知道,请检查我发布它的日期。这个问题迫使我手动指定更新
    • 评论是给其他人来回答这个问题的
    【解决方案3】:

    这个问题是因为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
    

    【讨论】:

    • 如上所说,最好不要使用sudo,因为它可能会在以后进行更新和工作时导致权限冲突。
    【解决方案4】:

    在我的情况下,升级到更新的 angular-devkit 解决了这个问题。

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

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

    【讨论】:

      【解决方案5】:

      在使用 npm 全局安装某些东西时不要使用sudo!!!

      如果由于EACCES 问题导致全局安装失败,请检查此page

      【讨论】:

      • OP 没有说任何关于 sudo 的内容,这不是一个答案,如果它是相对的,应该作为评论添加。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-05-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-11-23
      • 2022-07-28
      • 1970-01-01
      相关资源
      最近更新 更多