尝试安装类验证器和类转换器时,NestJS“警告 EBADENGINE 不支持的引擎@angulardevkit”

Amb*_*osh 7 ubuntu node.js npm angular nestjs

我正在 NestJS 网站上学习该课程。我需要安装类验证器和类转换器npm i class-validator class-transformer

但是当我这样做时,我收到错误:

npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '@angular-devkit/core@12.2.10',
npm WARN EBADENGINE   required: {
npm WARN EBADENGINE     node: '^12.14.1 || >=14.0.0',
npm WARN EBADENGINE     npm: '^6.11.0 || ^7.5.6',
npm WARN EBADENGINE     yarn: '>= 1.13.0'
npm WARN EBADENGINE   },
npm WARN EBADENGINE   current: { node: 'v16.11.0', npm: '8.0.0' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '@angular-devkit/schematics@12.2.10',
npm WARN EBADENGINE   required: {
npm WARN EBADENGINE     node: '^12.14.1 || >=14.0.0',
npm WARN EBADENGINE     npm: '^6.11.0 || ^7.5.6',
npm WARN EBADENGINE     yarn: '>= 1.13.0'
npm WARN EBADENGINE   },
npm WARN EBADENGINE   current: { node: 'v16.11.0', npm: '8.0.0' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '@angular-devkit/schematics-cli@12.2.10',
npm WARN EBADENGINE   required: {
npm WARN EBADENGINE     node: '^12.14.1 || >=14.0.0',
npm WARN EBADENGINE     npm: '^6.11.0 || ^7.5.6',
npm WARN EBADENGINE     yarn: '>= 1.13.0'
npm WARN EBADENGINE   },
npm WARN EBADENGINE   current: { node: 'v16.11.0', npm: '8.0.0' }
npm WARN EBADENGINE }
Run Code Online (Sandbox Code Playgroud)

我不明白如何解决这个问题。

NestJS 和 Angular 似乎意识到了这个问题,因为两个团队在 GitHub Memory 上进行了简短的讨论。最新版本的 Angular 不支持 npm 8 或更高版本?

但 Angular 团队似乎在 2021 年 10 月 20 日 - 4 天前的版本中发布了修复程序

我正在使用 Ubuntu 20.04
Node 16.11
npm 8

我需要做什么来解决这个问题?

Zhe*_*nov 9

2021 年 11 月 18 日更新:

\n

NestJS 已更新依赖项(特别是@nestjs/cli@8.1.5),\n因此现在您可以更新项目依赖项(只需运行npm update)并切换回使用 npm@8 (只需运行npm install -g npm@8)。

\n

原答案:

\n

是的,您今天应该做的 \xe2\x80\x94 是将 npm 降级到版本 7。\n为此,只需运行npm install -g npm@7.

\n

Npm v8 支持已经添加到 Angular ( https://github.com/angular/angular-cli/blob/master/CHANGELOG.md#12211-2021-10-20 ),但我们仍在等待 NestJS 更新的依赖关系。一旦发生这种情况,您应该能够通过运行切换回 npm v8npm i -g npm@8.

\n