Code Monkey home page Code Monkey logo

Comments (12)

scothis avatar scothis commented on June 10, 2024 1

Possibly related cujojs/rest#137

In this case, it looks like the browser bundle is trying to be loaded, but can't be resolved correctly. I'm not sure why the browser bundle is trying to be loaded, or why it can't be found.

from when.

simison avatar simison commented on June 10, 2024 1

I solved this issue by creating a npm-shrinkwrap.json file and overwriting browser field which was causing issues:

{
  "dependencies": {
    "when": {
      "version": "3.7.7",
      "from": "[email protected]",
      "browser": false
    }
  }
}

Overwrites this: https://github.com/cujojs/when/blob/master/package.json#L75-L78

@briancavalier it's really easy and quick to set up React Native test app if you wanna do some further testing around this problem; it should be pretty easy to solve.

If I would hit this issue by using when directly, I'd just switch to using something else instead. Now I hit the problem trough sub-dependencies (of Mopidy) so I had to fix it with this hack.

This works only with React Native v0.35+ (facebook/react-native@5710b23)

from when.

wangjia184 avatar wangjia184 commented on June 10, 2024 1

@beerTeam , try to use the minimal version of javascript file in nodejs. The minimal version should include when.js by itself.

from when.

briancavalier avatar briancavalier commented on June 10, 2024

Hi @wangjia184. I don't use FB React Native, but when certainly works in Node.js versions 0.8 thru 5.x. Can you provide a bit more context about the example code you showed?

when.lift(all)

For example, what is all? The purpose of when.lift is to take a non-promise-returning function, and give you back a promise-returning version of that function. So, the input to when.lift (in this case, all), must be a function.

Also, can you provide a complete stack trace of the error?

Thanks!

from when.

briancavalier avatar briancavalier commented on June 10, 2024

@wangjia184 Sorry, I realize I misunderstood the issue. So, just want to make sure I understand: the error you are seeing is coming from within when.js itself, and not from code you've written, simply by calling require('when')?

from when.

wangjia184 avatar wangjia184 commented on June 10, 2024

yes, only require cause an error

from when.

wangjia184 avatar wangjia184 commented on June 10, 2024

facebook react native takes use of nodejs,but there must be some difference

from when.

briancavalier avatar briancavalier commented on June 10, 2024

Yeah, it does look like it could be related, @scothis.

Since when.js is known to work on a wide variety of platforms, it probably also makes sense to open an issue with react native, as it looks like they have been working out kinks in their module loading. Apparently, they do override or modify node's require, and it doesn't quite line up with node's conventions in some cases.

Plus, they may be able to help us more quickly than we could figure this out on our own!

@wangjia184 Do you want to do that, or want me to do it?

from when.

wangjia184 avatar wangjia184 commented on June 10, 2024

thank you ,please open one

from when.

wangjia184 avatar wangjia184 commented on June 10, 2024

My colleague managed to fix the problem, it seems the file path is incorrect in React Native..

For example require('../lib...) should be require('../../lib....')
Hope he can send a pull request

from when.

briancavalier avatar briancavalier commented on June 10, 2024

Hey @wangjia184, thanks for the update. Do you mean that there is a bug in React Native?

from when.

aaerofeev avatar aaerofeev commented on June 10, 2024

I can not use this, the error always occurs because of the third-party say: "peer component invalid: [email protected]", when i using npm-shrinkwrap. Do you know other ways to fix this problem with whenjs
RN 0.44

from when.

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.