angular: Unable to use v12 with node v15+ ("engines.node" field misuse)

Description

The engine "node" is incompatible with this module. Expected version "^12.14.1 || ^14.0.0". Got "15.14.0"

Minimal Reproduction

See the issue title.

Your Environment

node v15.14.0 (npm v7.7.6).

Angular Version:

v12 stack.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 15
  • Comments: 29 (9 by maintainers)

Commits related to this issue

Most upvoted comments

Wouldnt it be better to have a recommendation instead of forbidding to use newer versions? How it is right now it will fail hard: Local development is no more possible without use of nvm and pipelines are failing.

Update: We have decided to update the field to be less restrictive (see #42205).

We will work to surface the Node supported version information in the ng version output to express when an unsupported version of node is being used.

The migration guide states it doesnt work with v10 or less but it doesnt state it does not work with v15 or higher:

Bildschirmfoto 2021-05-17 um 11 38 23

Totally agree, looks strange to limit node version. For example, m1 users are able to use only 15-16 version. Looking forward to hear info from contributors 😳

@vladimiry has a point here regarding the ignore-engines flag. turning it off globally is a red flag. in our pipelines we’ve had to downgrade node to get along with the new version which has a lot higher emotional cost than technical cost 😉 most npm projects tend to restrict engines downward and for known issues only. for the peace of my heart and those of our team I would kindly propose to do the same and only bar engine versions that are positively known to break

@MickL Both yarn and npm have support for ignoring engine requirements, so you should be able to rely on those if you would like to use these unsupported versions in your development.

Yarn

yarn config set ignore-engines true - Set the config for all yarn usage yarn install --ignore-engines - Ignore the engines for the specific yarn install run

NPM

From my understanding, npm only warns for engines unless engine-strict in your config is set true in your .npmrc. If however it still is erroring instead of warning, you can overide the engine requirement with --force.

I was also really confused to get this error message when upgrading my project to Angular 12. As you mention @vladimiry, Angular applications aren’t actually served using Node.js, unless you’d explicitly run a ng serve --prod which then explicitly mentions you shouldn’t be using that for production. Node.js is a development time thing only.

@josephperrott: are we missing something in the above reasoning? Sorry for mentioning you explicitly, but it looks like you introduced the change 17 days ago?

I feel this change unnecessarily restricts the supported Node.js versions and causes confusion for people upgrading with Node 15 or even 16 installed for no real reason?

Reopening since the below statement listed at https://nodejs.org/en/about/releases/ only related to use nodejs in production when in the case of Angular nodejs is used in development time/mode only (for compiling to a regular/static web resources).

Production applications should only use Active LTS or Maintenance LTS releases

Node 16 is going to be the active version in october, and everything just works fine with it (if you ignore the warning), I don’t really see a reason to not allow it…

Latest node versions are production ready, they just dont have long time support.

The Angular CLI and the set of framework packages (compiler, compiler-cli, localize, etc.) it directly uses are an application, though, which depends heavily on the behavior and API of Node.js. The stability of a deployed application is linked to the stability of the tools used to create it. However, as mentioned, this is distinct from the question of whether all of the packages should contain hard install errors.