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

node-fetch 3.x broken in jest #20

Open
yunnysunny opened this issue Nov 11, 2022 · 2 comments
Open

node-fetch 3.x broken in jest #20

yunnysunny opened this issue Nov 11, 2022 · 2 comments

Comments

@yunnysunny
Copy link

yunnysunny commented Nov 11, 2022

node-fetch use esm with 3.x, which not support with jest now, see the issue here node-fetch/node-fetch#1503 .
So, can we roll back the node-fetch to 2.6 to resolve the problem?

@yunnysunny yunnysunny closed this as not planned Won't fix, can't repro, duplicate, stale Nov 15, 2022
@yunnysunny yunnysunny reopened this Nov 15, 2022
@rschristian
Copy link

There's nothing for the lib to correct, the peer dep on node-fetch allows any version to satisfy it:

"peerDependencies": {
"node-fetch": "*"
},

Use whichever version you'd like. It's up to you.

@marabesi
Copy link

I think I faced the same issue trying to use this library with node 16, which was working fine until I tried to update the dependencies I have in my project.

Before starting, this is what I have:

npm@8.15.0
v16.17.1

Besides that, I was using nodejs 16 since I started the project, but just now I realize I needed to update its dependencies, in doing so through npm update this is the error I get:

image

I think this error is possibly related to this issue that @yunnysunny reported as I started to dive in a bit and found that the issue is in the node-fetch import:

image

This issue seems to be related to the node version and also to version 3.3+ from node-fetch. I think this issue is related.

The way I fixed the issue temporarily was to install the lib node-fetch 3.0.0 in my project as mentioned by @rschristian, but it has some security issues reported.

I think that the question going forward here is if it is possible to support newer versions of node-fetch here.

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

3 participants