GithubHelp home page GithubHelp logo

Unable to resolve module stream about metro HOT 4 OPEN

boh001 avatar boh001 commented on April 28, 2024
Unable to resolve module stream

from metro.

Comments (4)

robhogan avatar robhogan commented on April 28, 2024 1

but i dont understand why it doesn't work when unstable_enablePackageExports is enabled. i guess if problem is ws as you said, It should have been equally bad when this option is disabled, but it works.

It's probably upstream of ws - my guess is that you have a dependency which only requires ws when running under Node.js, and it's the entry point to that dependency that's being resolved differently with unstable_enablePackageExports. You'd need to find out what's requiring ws - pnpm why ws might have some clues.

from metro.

robhogan avatar robhogan commented on April 28, 2024

Hi @boh001. ws is a WebSocket implementation for Node.js, and not compatible (or necessary) for the browser or React Native (which has a native WebSocket global).

If you're not importing ws directly it might be a dependency of one of your dependencies.

If you have a require stack, we can see why it's being imported. It may be that an intermediate dependency is resolving to a Node.js version.

from metro.

boh001 avatar boh001 commented on April 28, 2024

@robhogan thank you for reply. I think that's all there is to the require stack

error: Error: Unable to resolve module stream from /Users/sanghyeon/projects/plzsub/node_modules/.pnpm/[email protected]/node_modules/ws/lib/stream.js: stream could not be found within the project or in these directories:
  ../../../node_modules/.pnpm/[email protected]/node_modules
  ../../../node_modules
  1 | 'use strict';
  2 |
> 3 | const { Duplex } = require('stream');
    |                             ^
  4 |
  5 | /**
  6 |  * Emits the `'close'` event on a stream.
    at ModuleResolver.resolveDependency (/Users/sanghyeon/projects/plzsub/node_modules/.pnpm/[email protected]/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:153:15)
    at DependencyGraph.resolveDependency (/Users/sanghyeon/projects/plzsub/node_modules/.pnpm/[email protected]/node_modules/metro/src/node-haste/DependencyGraph.js:279:43)
    at /Users/sanghyeon/projects/plzsub/node_modules/.pnpm/[email protected]/node_modules/metro/src/lib/transformHelpers.js:176:21
    at resolveDependencies (/Users/sanghyeon/projects/plzsub/node_modules/.pnpm/[email protected]/node_modules/metro/src/DeltaBundler/buildSubgraph.js:56:25)
    at visit (/Users/sanghyeon/projects/plzsub/node_modules/.pnpm/[email protected]/node_modules/metro/src/DeltaBundler/buildSubgraph.js:107:30)
    at async Promise.all (index 1)
    at async visit (/Users/sanghyeon/projects/plzsub/node_modules/.pnpm/[email protected]/node_modules/metro/src/DeltaBundler/buildSubgraph.js:116:5)
    at async Promise.all (index 8)
    at async visit (/Users/sanghyeon/projects/plzsub/node_modules/.pnpm/[email protected]/node_modules/metro/src/DeltaBundler/buildSubgraph.js:116:5)
    at async Promise.all (index 0)

but i dont understand why it doesn't work when unstable_enablePackageExports is enabled. i guess if problem is ws as you said, It should have been equally bad when this option is disabled, but it works.

thank you :)

from metro.

boh001 avatar boh001 commented on April 28, 2024

pnpm why ws shows nothing. it's so weird.
for now, it looks like the only way is to disable this option. is it okay to leave the issue open for people have the same problem? Maybe someone will solve it one day :)

from metro.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.