7

I am working through the course on the NestJS website. I need to install class-validator and class-transformer npm i class-validator class-transformer

But when I do I get error:

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 }

I don't understand how to fix this.

NestJS and Angular seem to be aware of this issue as there has been a brief discussion between the 2 teams on GitHub Memory. Something about the latest version of Angular not supporting npm 8 or higher?

But it seems like the Angular team released a fix for this in the release on 20th October 2021 - 4 days ago

I am using Ubuntu 20.04
Node 16.11
npm 8

What do I need to do to resolve this?

Ambassador Kosh
  • 459
  • 5
  • 19

1 Answers1

9

Updated 18.11.2021:

NestJS has updated the dependencies (in particular @nestjs/cli@8.1.5), so now you can update your project dependencies (just run npm update) and switch back to using npm@8 (just run npm install -g npm@8).

Original answer:

Yes, what you should do today — is downgrade npm to version 7. To do this, just run npm install -g npm@7.

Npm v8 support has already been added to angular (https://github.com/angular/angular-cli/blob/master/CHANGELOG.md#12211-2021-10-20), but we are still waiting for NestJS to update the dependencies. As soon as that happens, you should be able to switch back to npm v8 by running npm i -g npm@8.