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

Breaking change for node versions < 20 #201

Closed
sahariko opened this issue Oct 16, 2024 · 13 comments
Closed

Breaking change for node versions < 20 #201

sahariko opened this issue Oct 16, 2024 · 13 comments

Comments

@sahariko
Copy link

  • react-error-boundary version: 4.1.0
  • node version: 18.12.1
  • npm version: 8.19.2

What you did:
Upgraded from version 4.0.3 to 4.1.0

What happened:

error [email protected]: The engine "node" is incompatible with this module. Expected version ">=20". Got "18.12.1"

Problem description:
Version 4.1.0 inadvertently introduced a breaking change with the addition of the engines field to package.json.
Up until this point this package worked fine with versions of node older than 20.

Suggested solution:
Reduce the engines's node version demand.

@bvaughn
Copy link
Owner

bvaughn commented Oct 16, 2024

I’m not sure I understand why that setting affects your package. Unless you were trying to build it from source, I don’t understand why the engines setting would impact you?

@onethread
Copy link

onethread commented Oct 16, 2024

Getting the same. Yarn is throwing an error for me.

Screenshot 2024-10-16 at 09 50 40

I think engine compatibility with deps has been a thing for a long time now. Npm added it in 2010 npm/npm#6

Fwiw, there is no compiled version in js land, so everything in js land is indeed using direct source.

@sahariko
Copy link
Author

I’m not sure I understand why that setting affects your package. Unless you were trying to build it from source, I don’t understand why the engines setting would impact you?

@bvaughn my project is failing during installation, specifically when running yarn install.

@christinna9031
Copy link

Can confirm we're getting the exact same error.

@bvaughn
Copy link
Owner

bvaughn commented Oct 17, 2024

That's interesting. I wouldn't have expected that since there's no postinstall script or anything 🤔 Hmm. I will roll that change back.

@bvaughn
Copy link
Owner

bvaughn commented Oct 17, 2024

Sorry about this, folks. Hopefully [email protected] resolves this issue for everyone?

@bvaughn bvaughn closed this as completed Oct 17, 2024
@Frecherenkel60
Copy link

I’m not sure I understand why that setting affects your package. Unless you were trying to build it from source, I don’t understand why the engines setting would impact you?

The engines field imposes restrictions on consumers (docs). On another note, could you also please remove the requirement for pnpm? We're still using yarn (unluckily) and get warnings during install.

 warning [email protected]: The engine "pnpm" appears to be invalid.

@bvaughn
Copy link
Owner

bvaughn commented Oct 18, 2024

The "engines" block helps me keep my own PNPM versions straight (so I'm not clobbering my lock files when switching between projects). I should probably find a better way to do this but I'm struggling to have enough time to maintain my open source projects on top of my day job and I'm not sure when I'll get to it.

What you're reporting here is a Yarn v1 bug. Yarn should not be warning about other engines. You can silence the warning for yourselves though by adding the following lines to your .yarnrc:

ignore-engines pnpm

@Frecherenkel60
Copy link

The "engines" block helps me keep my own PNPM versions straight (so I'm not clobbering my lock files when switching between projects). I should probably find a better way to do this but I'm struggling to have enough time to maintain my open source projects on top of my day job and I'm not sure when I'll get to it.

What you're reporting here is a Yarn v1 bug. Yarn should not be warning about other engines. You can silence the warning for yourselves though by adding the following lines to your .yarnrc:

ignore-engines pnpm

Wow, I completely misunderstood the concept of the engines field then, sorry for that.

@bvaughn
Copy link
Owner

bvaughn commented Oct 18, 2024

No, I'm pretty sure that I misunderstood it (at least the scope of it). I didn't think it would impact anything other than if you were executing package scripts within the repo. As this issue has shown me, it affects installs as well 😭

I'm really sorry that it caused this issue for others, and I'd like to fix it, I just don't have as much free time as I used to 🙇🏼 I appreciate everyone being patient.

@Frecherenkel60
Copy link

Frecherenkel60 commented Oct 18, 2024

No, I'm pretty sure that I misunderstood it (at least the scope of it). I didn't think it would impact anything other than if you were executing package scripts within the repo. As this issue has shown me, it affects installs as well 😭

I'm really sorry that it caused this issue for others, and I'd like to fix it, I just don't have as much free time as I used to 🙇🏼 I appreciate everyone being patient.

Well, if it's only about keeping your PNPM versions straight, you could probably enable corepack. You can specify a packageManager field in your package.json where you can pin your versions without affecting your consumers. Here's the according documentation. :)

@bvaughn
Copy link
Owner

bvaughn commented Oct 18, 2024

Hmm, Corepack is still experimental isn't it? Either way, until I've done that in all of my projects, it seems like it's too easy to forget to use it and just run pnpm directly (which I think would just "work")

@Frecherenkel60
Copy link

Well, yeah. It is still experimental and there are still vivid discussions about the future of it. In my experience it is still worth to use it, because it simplifies the development of multiple projects on the same device without a lot of effort.

Basically you would only need to set the packageManager field in the package.json of every project you're using and run corepack enable once per node version. The rest will be handled by corepack in a predictable fashion as outlined in their docs:

  • If the packageManager field is populated in a project and you have the version installed it will directly use it
  • If the packageManager field is populated in a project and you don't have the version installed it will ask you to download it
  • If the packageManager field is not populated in a project it will use a "known good release"

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

5 participants