node.js - 尝试安装类验证器和类转换器时,NestJS“警告 EBADENGINE 不支持的引擎 @angulardevkit”
问题描述
我正在学习 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 }
我不明白如何解决这个问题。
NestJS 和 Angular 似乎意识到了这个问题,因为这两个团队在 GitHub Memory 上进行了简短的讨论。最新版本的 Angular 不支持 npm 8 或更高版本?
但似乎 Angular 团队在 2021 年 10 月 20 日 - 4 天前的版本中对此进行了修复
我正在使用 Ubuntu 20.04
节点 16.11
npm 8
我需要做什么来解决这个问题?
解决方案
2021 年 11 月 18 日更新:
NestJS 已经更新了依赖项(特别是@nestjs/cli@8.1.5
),所以现在您可以更新项目依赖项(只需运行npm update
)并切换回使用 npm@8(只需运行npm install -g npm@8
)。
原答案:
是的,你今天应该做的就是将 npm 降级到版本 7。为此,只需运行npm install -g npm@7
.
Npm v8 支持已经添加到 angular ( https://github.com/angular/angular-cli/blob/master/CHANGELOG.md#12211-2021-10-20 ),但我们仍在等待 NestJS 更新依赖项。一旦发生这种情况,您应该能够通过运行切换回 npm v8 npm i -g npm@8
。
推荐阅读
- r - 有效地从向量中删除 n 个随机条目,其中 n 可能为 0
- sql - 在 SQL Server 中使用带有 XML 的两个表中的公共字段
- symfony - symfony querybuilder 用于按集合中的关系进行搜索
- terraform - Terraform 错误创建 Lambda 函数:ResourceConflictException 与刚刚由 Terraform 创建的资源应用
- api - Discord API 只返回一个成员
- python - 用格式变量声明变量的目的是什么:类类型=在python中?
- visual-studio - Visual Studio NUnit 测试未运行
- sql - SQL DB2 Toad - 按 ID 从两个表中求和
- node.js - 我希望 req.body.date 只显示日期而不是时间和时区
- makefile - 编译失败,“重定位 R_X86_64_32 对 '.rodata' 不能在制作 PIE 对象时使用;使用 -fPIE 重新编译