GithubHelp home page GithubHelp logo

Comments (14)

MatthewDevelop avatar MatthewDevelop commented on May 22, 2024 16

just use npm install querystring
it works for me

from nba.

ajaymarathe avatar ajaymarathe commented on May 22, 2024 5

just use npm install querystring
it works for me

Works for me too :)

from nba.

giacomocerquone avatar giacomocerquone commented on May 22, 2024 1

@MatthewDevelop Just porting a node crypto dependant project into react-native and solved that package's querystring dependency like this!
Love you

from nba.

bttmly avatar bttmly commented on May 22, 2024

Try [email protected] – I've removed querystring as a dependency. Please let me know if it works or not when you get a chance!

from nba.

fzymek avatar fzymek commented on May 22, 2024

hmm.. now I am getting the same error but for different module:

Unable to resolve module `url` from `/Users/zymfilip/Development/src/NBABrowseApp/node_modules/nba/src/get-json.js`: Module does not exist in the module map

it seems to be related to react-native and the issue they are mentioning in error log facebook/react-native#4968

I tried creating simple node app and it works without a problem. Both 4.2.0 and 4.2.1

from nba.

bttmly avatar bttmly commented on May 22, 2024

Hm alright yeah so react-native can't pull in Node.js builtin modules (both querystring and url are provided by Node.js but included in the browser build by Browserify).

Question for you: do you have the global URL constructor available in react-native? It's a browser feature https://developer.mozilla.org/en-US/docs/Web/API/URL

from nba.

bttmly avatar bttmly commented on May 22, 2024

I added an explicit url dependency in [email protected] – can you try that one? Sorry for the back-and-forth

from nba.

fzymek avatar fzymek commented on May 22, 2024

No problem, but still no luck ;(

error: bundling failed: Error: Unable to resolve module `http` from `/Users/zymfilip/Development/src/NBABrowseApp/node_modules/node-fetch/index.js`: Module does not exist in the module map

This might be related to https://github.com/facebook/react-native/issues/4968

Regarding URL, it looks that there are some issues with URL in RN facebook/react-native#16434 lately.

It seems that there are some conflicts as I tried adding dependency on http module in my app and I got following error:

error: bundling failed: Error: While trying to resolve module `http` from file `/Users/zymfilip/Development/src/ReactiveAirQuality/node_modules/node-fetch/index.js`, the package `/Users/zymfilip/Development/src/ReactiveAirQuality/node_modules/http/package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`/Users/zymfilip/Development/src/ReactiveAirQuality/node_modules/http/index.js`. Indeed, none of these files exist:

  * `/Users/zymfilip/Development/src/ReactiveAirQuality/node_modules/http/index.js(.native||.ios.js|.native.js|.js|.ios.json|.native.json|.json)`
  * `/Users/zymfilip/Development/src/ReactiveAirQuality/node_modules/http/index.js/index(.native||.ios.js|.native.js|.js|.ios.json|.native.json|.json)`

It seems to me (but I might be wrong as I am quite new to node & react-native) that you are using some dependencies not supported in RN. Is it possible?

from nba.

bttmly avatar bttmly commented on May 22, 2024

Yes that's exactly the problem: url, querystring, and http all come from NodeJS – when used outside of Node they need a build step to pull in browser-compatible substitutes for these packages. Can you try the following:

import nba from "nba/dist/nba"

This points directly to the library bundled with all of its dependencies

from nba.

fzymek avatar fzymek commented on May 22, 2024

Still no luck

error: bundling failed: Error: Unable to resolve module `./src` from `/Users/zymfilip/Development/src/ReactiveAirQuality/node_modules/nba/dist/nba.js`: The module `./src` could not be found from `/Users/zymfilip/Development/src/ReactiveAirQuality/node_modules/nba/dist/nba.js`. Indeed, none of these files exist:

  * `/Users/zymfilip/Development/src/ReactiveAirQuality/node_modules/nba/dist/src(.native||.ios.js|.native.js|.js|.ios.json|.native.json|.json)`
  * `/Users/zymfilip/Development/src/ReactiveAirQuality/node_modules/nba/dist/src/index(.native||.ios.js|.native.js|.js|.ios.json|.native.json|.json)`

from nba.

bttmly avatar bttmly commented on May 22, 2024

Damn. Alright, I'll try compiling it with webpack instead of browserify and see if that helps. I'll get back to you in a couple days

from nba.

binbinla avatar binbinla commented on May 22, 2024

same issue here.

from nba.

bttmly avatar bttmly commented on May 22, 2024

This totally slipped my mind. Now that the season is about to start... I just published [email protected] can someone try using import nba from "nba/dist/webpacked"?

from nba.

bttmly avatar bttmly commented on May 22, 2024

great! closing, but if someone else runs into a similar problem please open an issue

from nba.

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.