Closed vejja closed 6 months ago
Hi. Please try recreating your lockfile using npx nuxi upgrade --force
this ensures to use latest compatible node-fetch-native build. unofrotounatly nothing we can do in giget itself to mitigate package manager hoisting issues.
I'm experiencing this bug as well in a non-nuxt Bun project.
$ bun build src/index.ts --outdir dist --target node
11 | import { fetch } from 'node-fetch-native/proxy';
^
error: No matching export in "node_modules/node-fetch-native/dist/proxy.cjs" for import "fetch"
at /Users/thomaskjaergaard/projects/internal/wah-cli-v3/node_modules/giget/dist/index.mjs:11:10
error: script "build" exited with code 1
@tkjaergaard can you please share your project or a reproduction? 🙏🏼
@pi0
Bun: 1.0.25
Git repo: https://github.com/tkjaergaard/giget-bun-reproduction
Steps to reproduce
bun install
to install dependencies$ bun build index.ts --outdir=dist --target=node
Error
11 | import { fetch } from 'node-fetch-native/proxy';
^
error: No matching export in "node_modules/node-fetch-native/dist/proxy.cjs" for import "fetch"
at /Users/thomaskjaergaard/projects/internal/giget-bun-reproduction/node_modules/giget/dist/index.mjs:11:10
Thanks. I will investigate in https://github.com/unjs/giget/issues/145 👍🏼
Environment
giget 1.2.1 Node 18 Nuxt 3.8.2, 3.9.0, 3.9.1 Nitro 2.8.1
Reproduction
Sorry unable to provide repro as this only appears in workers environment This was reported on Cloudflare, Vercel
Does not appear in NodeJS, local environments
Describe the bug
Initial bug report was filed in Nuxt-Security there We initially thought the issue was on our side but were unable to reproduce
Then one user filed logs, and we realized the error was triggered by
giget
while trying to usenode-fetch-native
in Workers environmentsAdditional context
nitropack
to 2.8.1nitropack@2.8.1
upgradednode-fetch-native
to 1.6.1giget
is trying to usenode-fetch-native
's proxy feature, which was not available in 1.4.1node-fetch-native
1.4.1This looks like a version dependency mismatch on
node-fetch-native
This is very strange because package managers should usually be able to resolve the correct version without any issue In fact, in NodeJS environments the issue does not existHowever for some unknown reason, it seems to affect Workers environment
Logs