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

Can't resolve 'stream/web' ./undici/lib/fetch #1541

Closed
ArthurBonsu opened this issue Jul 13, 2022 · 16 comments
Closed

Can't resolve 'stream/web' ./undici/lib/fetch #1541

ArthurBonsu opened this issue Jul 13, 2022 · 16 comments
Labels
bug Something isn't working

Comments

@ArthurBonsu
Copy link

Bug Description

Reproducible By

Expected Behavior

Logs & Screenshots

./node_modules/hardhat/node_modules/undici/lib/core/util.js
Module not found: Can't resolve 'stream/web' in 'D:\BLOCKCHAIN EXPERIMENTAL LAB\flowstationyarnV2\flowstationyar
n\flowstationkingdom\node_modules\hardhat\node_modules\undici\lib\core'

Import trace for requested module:
./node_modules/hardhat/node_modules/undici/index.js
./node_modules/hardhat/internal/hardhat-network/jsonrpc/server.js
./node_modules/hardhat/builtin-tasks/node.js
./node_modules/hardhat/internal/core/tasks/builtin-tasks.js
./node_modules/hardhat/internal/core/config/config-loading.js
./node_modules/hardhat/internal/lib/hardhat-lib.js
./pages/originaltokenswap.tsx

./node_modules/hardhat/node_modules/undici/lib/fetch/body.js
Module not found: Can't resolve 'util/types' in 'D:\BLOCKCHAIN EXPERIMENTAL LAB\flowstationyarnV2\flowstationyar
n\flowstationkingdom\node_modules\hardhat\node_modules\undici\lib\fetch'

Import trace for requested module:
./node_modules/hardhat/node_modules/undici/lib/fetch/response.js
./node_modules/hardhat/node_modules/undici/index.js
./node_modules/hardhat/internal/hardhat-network/jsonrpc/server.js
./node_modules/hardhat/builtin-tasks/node.js
./node_modules/hardhat/internal/core/tasks/builtin-tasks.js
./node_modules/hardhat/internal/core/config/config-loading.js
./node_modules/hardhat/internal/lib/hardhat-lib.js
./pages/originaltokenswap.tsx

./node_modules/hardhat/node_modules/undici/lib/fetch/body.js
Module not found: Can't resolve 'stream/web' in 'D:\BLOCKCHAIN EXPERIMENTAL LAB\flowstationyarnV2\flowstationyar
n\flowstationkingdom\node_modules\hardhat\node_modules\undici\lib\fetch'

Import trace for requested module:
./node_modules/hardhat/node_modules/undici/lib/fetch/response.js
./node_modules/hardhat/node_modules/undici/index.js
./node_modules/hardhat/internal/hardhat-network/jsonrpc/server.js
./node_modules/hardhat/builtin-tasks/node.js
./node_modules/hardhat/internal/core/tasks/builtin-tasks.js
./node_modules/hardhat/internal/core/config/config-loading.js
./node_modules/hardhat/internal/lib/hardhat-lib.js
./pages/originaltokenswap.tsx

./node_modules/hardhat/node_modules/undici/lib/fetch/index.js
Module not found: Can't resolve 'stream/web' in 'D:\BLOCKCHAIN EXPERIMENTAL LAB\flowstationyarnV2\flowstationyar
n\flowstationkingdom\node_modules\hardhat\node_modules\undici\lib\fetch'

Import trace for requested module:
./node_modules/hardhat/node_modules/undici/index.js
./node_modules/hardhat/internal/hardhat-network/jsonrpc/server.js
./node_modules/hardhat/builtin-tasks/node.js
./node_modules/hardhat/internal/core/tasks/builtin-tasks.js
./node_modules/hardhat/internal/core/config/config-loading.js
./node_modules/hardhat/internal/lib/hardhat-lib.js
./pages/originaltokenswap.tsx

Environment

Additional context

@ArthurBonsu ArthurBonsu added the bug Something isn't working label Jul 13, 2022
@ronag
Copy link
Member

ronag commented Jul 13, 2022

Node version?

@ArthurBonsu
Copy link
Author

ArthurBonsu commented Jul 13, 2022 via email

@mcollina
Copy link
Member

+Can you provide steps to reproduce? We often need a reproducible example, e.g. some code that allows someone else to recreate your problem by just copying and pasting it. If it involves more than a couple of different file, create a new repository on GitHub and add a link to that.

@ronag
Copy link
Member

ronag commented Jul 13, 2022

We don't support node 16.4

@jimmywarting
Copy link
Contributor

fyi, stream/web seems like it was added in 16.5 #

@ArthurBonsu
Copy link
Author

ArthurBonsu commented Jul 13, 2022

@ArthurBonsu
Copy link
Author

ArthurBonsu commented Jul 13, 2022 via email

@ArthurBonsu
Copy link
Author

Problem Unresolved

@jimmywarting
Copy link
Contributor

jimmywarting commented Aug 1, 2022

guessing you have a build problem that can't resolve stream/web as an built in NodeJS module and so it thinks that it's a NPM module and can't resolve the NPM module.

maybe it is something that could have been resolved if undici would have used prefixed node:stream/web instead...?

@ArthurBonsu
Copy link
Author

ArthurBonsu commented Aug 1, 2022 via email

@il3ven
Copy link

il3ven commented Aug 1, 2022

I had this problem in a typescript project. I was able to solve it using npm install @types/node.

However, I still have a question. This project uses stream/web which is only available for node >=16. How is this project compatible with node versions <=16? The package.json of this project mentions node: >=12.18.

@jimmywarting
Copy link
Contributor

However, I still have a question. This project uses stream/web which is only available for node >=16. How is this project compatible with node versions <=16? The package.json of this project mentions node: >=12.18.

Only parts of the undici may be supported not all of it. fetch per say require 16+

@mcollina
Copy link
Member

mcollina commented Aug 1, 2022

I would be very happy to receive a PR with a fix for this that includes a unit test.

@il3ven
Copy link

il3ven commented Aug 1, 2022

I would be very happy to receive a PR with a fix for this that includes a unit test.

I'd be more than happy to contribute but I am not sure if this is a bug in undici. In my case, the problem was with my build process. Nothing to do with undici. I don't know about @ArthurBonsu's (OP) problem.

@ArthurBonsu
Copy link
Author

ArthurBonsu commented Aug 1, 2022 via email

@mcollina mcollina reopened this Aug 2, 2022
@jimmywarting
Copy link
Contributor

i think the issue is with hardhat...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants