Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@vue/cli-shared-utils dependency install breaks on npm / yarn install when using non-lts versions of node #29

Closed
RedNuttyGuy opened this issue Mar 30, 2022 · 5 comments

Comments

@RedNuttyGuy
Copy link

"node": "8 || 10 || 12 || 14 || 16 || 17"

This change broke builds requiring @vue/cli-shared-utils and non-lts versions of node.js

I have a pipeline requireing node 15.x for package compatibility reasons but changing the supported versions of node.js from >=8.0.0 to 8 || 10 || 12 || 14 || 16 || 17 causes the following error:

error @achrinza/node-ipc@9.2.2: The engine "node" is incompatible with this module. Expected version "8 || 10 || 12 || 14 || 16 || 17". Got "15.6.0"
error Found incompatible module.

I'm curious as to why was this change made, and can it be reverted?

Thanks.

@RedNuttyGuy RedNuttyGuy changed the title @vue/cli-shared-utils build pipeline broken when using non-lts versions of node @vue/cli-shared-utils dependency install breaks on npm / yarn install when using non-lts versions of node Mar 30, 2022
@achrinza
Copy link
Owner

achrinza commented Mar 31, 2022

Hi @RedNuttyGuy, thanks for opening an issue.

engines.* attributes are, by default, not enforced by Node.js nor NPM, and should not prevent use in "unsupported" Node.js versions.

I'm curious as to why was this change made

With the exception of the latest major version, we do not test against non-LTS versions. This seems to be the policy of node-ipc and has been the general policy for several FOSS projects. It also keeps the test matrix small-ish as new Node.js major versions get released.

In combination with the above statement on non-enforcement, this was done to give users a general recommendation on which Node.js versions are officially supported, and provide a warning when they do npm install:

npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '@achrinza/node-ipc@9.2.2',
npm WARN EBADENGINE   required: { node: '8 || 10 || 12 || 14 || 16 || 17' },
npm WARN EBADENGINE   current: { node: 'v15.14.0', npm: '7.7.6' }
npm WARN EBADENGINE }

So this is one of those non-functional deviations from upstream that we did.

I'm curious what environment is causing the error, as NPM v6/v7/v8 does not enforce this by default:

https://github.com/achrinzatest/achrinza--node-ipc--29/actions/runs/2069241961

@RedNuttyGuy
Copy link
Author

Hi @achrinza , thanks for the reply.

You're right, I think I was mistaken thinking the issue appied to npm.

The command I run is yarn global add @vue/cli @vue/cli-service-global @vue/cli-plugin-typescript during the setup of my automated build pipeline.

I get the error with yarn v1.22.5 in Bitbucket Pipelines. I tried running in my local environment as well running node v15.14.0 and yarn v1.22.17 and the same thing happened.

engines.* attributes are, by default, not enforced by Node.js nor NPM, and should not prevent use in "unsupported" Node.js versions.

I don't have much experience in creating open-source software and the best practices that go along with it. I would've expected that the version requirement was specified as > v8 and mentioning in the readme that only lts and current versions of node are tested on. Always learning about new ways of doing these things in different ways.

@RedNuttyGuy
Copy link
Author

I also had a look at some issue reports for yarn and it seems that npm stopped erroring on node version incompatibilities back in v3, whereas yarn didn't make this change.

We specifically chose a strict engine check with Yarn to encourage the ecosystem to properly use the engines field. Relaxing this would make the engines field useless and encourage already rampant misuse of it.

This justification in this RFC for relaxing this is mostly "npm doesn't do this and have deprecated it". Obviously we aren't adherent to the changes of npm and we deliberately deviated.

see yarnpkg/yarn#3430 and yarnpkg/rfcs#69

It seems that I can get around this issue by using the --ignore-engines option on yarn but I'd prefer not to for obvious reasons.

If you don't want to change the supported node version reported in the package.json thats no problem, and I'll add the above option to my build pipeline.

@achrinza
Copy link
Owner

achrinza commented Apr 1, 2022

Hi @RedNuttyGuy,

Thanks for the links provided; After looking through the options, we'll proceed with expanding the testing matrix and the engines.node metadata to include non-LTS Node.js versions for v9, which is what Vue uses.

We've reserved deciding for v10 as:

  1. There's more direct dependencies and
  2. It's the current, actively maintained version upstream

Which increase the chances of "breaking changes" occurring.

achrinza added a commit that referenced this issue Apr 1, 2022
closes: #29

Signed-off-by: Rifa Achrinza <25147899+achrinza@users.noreply.github.com>
achrinza added a commit that referenced this issue Apr 1, 2022
closes: #29

Signed-off-by: Rifa Achrinza <25147899+achrinza@users.noreply.github.com>
achrinza added a commit that referenced this issue Apr 1, 2022
closes: #29

Signed-off-by: Rifa Achrinza <25147899+achrinza@users.noreply.github.com>
@achrinza
Copy link
Owner

achrinza commented Apr 1, 2022

v9.2.3 has been published: https://github.com/achrinza/node-ipc/releases/tag/v9.2.3

AFAIK, Vue.js currently pins to @achrinza/node-ipc@9.2.2. You'll need them to update this dependency from their end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants