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

fix: update node-fetch for node v20 compatibility #6425

Closed
wants to merge 2 commits into from

Conversation

jakebailey
Copy link
Member

Fixes #6424 (probably)

Unfortunately, the old version of fetch appears to still be in the lockfile. I'm pretty sure that's because there are some cycles caused by @pnpm/meta-updater which depends on a bunch of old pnpm monorepo packages which are duplicating the tree.

@jakebailey
Copy link
Member Author

This is a bit of a chicken and egg problem, can't add tests for Node 20 because pnpm depends on pnpm to install.

@zkochan
Copy link
Member

zkochan commented Apr 18, 2023

isn't the latest node-fetch esm only?

@jakebailey
Copy link
Member Author

Apparently; I guess I didn't hit this in my own testing becuase the pnpm output is bundled and so doesn't hit this, but tests are not bundled so do.

Not quite sure what to do here.

@jakebailey jakebailey marked this pull request as draft April 18, 2023 20:39
@zkochan
Copy link
Member

zkochan commented Apr 18, 2023

The older version is not compatible with node.js v20?

@jakebailey
Copy link
Member Author

It would seem not, from my testing.

Given fetch is async, I do wonder if it could be async imported (not sure if that works while bundled), or, if we could just use the built-in fetch on newer versions of Node instead (since it's available in Node 18+?). I think use of node-fetch is pretty consolidated so that might be a good option.

Feel free to test things out on Node 20 separately; I just updated to see and was surprised to have this failure.

@zkochan
Copy link
Member

zkochan commented Apr 18, 2023

I'd rather not use different implementations on different versions.

If it is broken maybe we should fork it and make a fix. Or find an alternative.

@zkochan
Copy link
Member

zkochan commented Apr 19, 2023

Is undici the one that comes bundled with node.js? We can try to use it instead.

But I don't think it will be easy to migrate from node-fetch.

@so1ve
Copy link

so1ve commented Apr 19, 2023

How about using node-native-fetch? It uses expetimental built-in fetch if possible.

@zkochan zkochan closed this Apr 19, 2023
@zkochan
Copy link
Member

zkochan commented Apr 19, 2023

It doesn't matter. If we will use native only on some versions than pnpm will behave differently on different versions and it will be harder to investigate bugs.

I have forked node-fetch: https://github.com/pnpm/node-fetch

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

Successfully merging this pull request may close these issues.

"ERR_INVALID_THIS" on "pnpm up" in Node 20
3 participants