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

Error: Cannot find module './factoryWithThrowingShims' from '/app/node_modules/react-redux-firebase/dist' #128

Closed
karltaylor opened this issue May 10, 2017 · 23 comments

Comments

@karltaylor
Copy link
Contributor

Just did a fresh npm install on a new project and imported into my project and got

Error: Cannot find module './factoryWithThrowingShims' from '/app/node_modules/react-redux-firebase/dist'
    at /app/node_modules/browser-resolve/node_modules/resolve/lib/async.js:55:21
    at load (/app/node_modules/browser-resolve/node_modules/resolve/lib/async.js:69:43)
    at onex (/app/node_modules/browser-resolve/node_modules/resolve/lib/async.js:92:31)
    at /app/node_modules/browser-resolve/node_modules/resolve/lib/async.js:22:47
    at FSReqWrap.oncomplete (fs.js:123:15)
@prescottprue
Copy link
Owner

prescottprue commented May 10, 2017

What version did you npm install? You can check using npm ls react-redux-firebase (can you copy the output here or attach a screenshot)?

Also, what did you specify in your package.json for version or react-redux-firebase? What is your loader config look like (assuming you are using Webpack)?

Seems like it might be a loader issue since react-redux-firebase does not use async that I am aware of.

@danibrear
Copy link

danibrear commented May 11, 2017

getting this with
react-redux-firebase@1.4.0-rc.2
Although i'm also using: react@16.0.0-alpha.6

doing a little bit of digging it seems like it might be something to do with PropTypes being abstracted from the react library? Just a thought, haven't dug into the code too much.

@prescottprue
Copy link
Owner

prescottprue commented May 11, 2017

Interesting thought @DavidBrear.

Have you tried older versions of react-redux-firebase (i.e. v1.3.4 or v1.4.0-rc.1)? Usage of prop-types within react-redux-firebase didn't start until v1.4.0-rc.2.

Have you tried a v15 version of react like 15.5.4 (latest) or v15.3.2 (used in all of the react-redux-firebase examples)?

My guess is still that it is due to webpack loader parsing. If a reproduction repo can be provided or webpack loader config is provided, it would be easier to know.

@danibrear
Copy link

Moving to v1.4.0-rc.1 fixed it. I've pulled down the source to see if I could make a PR to fix in rc.2 will try to get to it today.

@prescottprue
Copy link
Owner

@DavidBrear That would be great. This is one of the last things to get ironed out before the v1.4.0 release.

If we can't get it ironed out, we might have to go back to not using prop-types (which will throw deprecation warnings for some)

prescottprue added a commit that referenced this issue May 16, 2017
* Switched back to importing PropTypes from react due to (#128)
* Roadmap updated with population features coming in `v1.5.0`
@prescottprue
Copy link
Owner

prescottprue commented May 16, 2017

v1.4.0-rc.3 has been released. It includes switching back to importing PropTypes from react instead of prop-types (which has been moved to 1.5.0 within the roadmap).

@DavidBrear This means you should be able to use v1.4.0-rc.3, let me know if you get a chance to check it out. If so, planning on releasing v1.4.0 from rc.3.

Note: Issue remaining open until this is out of pre-release

@prescottprue prescottprue self-assigned this May 16, 2017
@prescottprue prescottprue added this to the v1.4.0 milestone May 16, 2017
@prescottprue
Copy link
Owner

prescottprue commented May 17, 2017

v1.4.0 has been released so this is now out of pre-release. prop-types usage has been moved out to v1.5.0.

@miketamis
Copy link

Im still getting this error:

Building JavaScript bundle: error
Unable to resolve module `./factoryWithThrowingShims` from `/node_modules/react-redux-firebase/dist/react-redux-firebase.js`: Directory /node_modules/react-redux-firebase/dist/factoryWithThrowingShims doesn't exist

my version react-redux-firebase@1.5.0-alpha

@prescottprue
Copy link
Owner

@miketamis What is your webpack config? Are you using webpack 1 or 2?

Can anyone provide a repo where this can be reproduced?

@prescottprue prescottprue reopened this May 24, 2017
@prescottprue
Copy link
Owner

prescottprue commented May 24, 2017

Another theory:

It may have to due with prop-types needing to be set as an external in the webpack config. This would make it so that prop-types points to the one required by your project instead of being included in the bundle (means that prop-types will instead of a peer dependency instead of dependency).

Again, can only be tested/confirmed if a repro is provided.

@ricardokdz
Copy link

i have the same problem using react and react native

@miketamis
Copy link

Yeap this error for me was with Expo. I fix it by putting the proptype repo into the react-redux-firebase dist folder in node_modules (obviously not a good fix)

@prescottprue
Copy link
Owner

prescottprue commented May 25, 2017

@ricardokdz and @miketamis ok, going to try some stuff and hopefully get a alpha.2 version out soon that address this

@ricardokdz
Copy link

@miketamis Does not work for me. How's your directory structure?

@prescottprue
Copy link
Owner

@ricardokdz The directory structure shouldn't be causing any issues. I have been using both the material example and the react-native examples to test.

Can you provide a repo that you are working on to reproduce the issue? For now I am just having to guess at things that might fix the issue.

@prescottprue
Copy link
Owner

@ricardokdz @miketamis @karltaylor What version of webpack are you using? Can you possibly post your webpack.config? If using webpack 2, how do your webpack configs compare to the webpack2 example?

I am able to use v1.5.0-alpha with both webpack 1 and 2 with no issues.

browser field

It has come to my attention though that more often that not (seems like it is happening in your case) bundling libraries end up using the browser field of package.json if it is defined. In the case of react-redux-firebase, that points to the bundled/webpacked version (which may not be what you want if you are also using webpack).

If we can confirm that this is what is happening, I can release 1.5.0-alpha.2 with the only change being removal of the browser field from the package file. That way, only the module version can be loaded (shouldn't cause dependency errors since it is not bundled).

prescottprue added a commit that referenced this issue May 30, 2017
### Description
Removed `browser` field from `package.json` in attempt to solve #128 

### Check List

- [X] All tests passing
- [X] Docs updated with any changes or examples

### Relevant Issues
* [#128](https://github.com/prescottprue/react-redux-firebase/issues/#128)
@prescottprue
Copy link
Owner

v.1.5.0-alpha.2 was released without the browser field within package.json. This means that webpack should no longer point to the bundle (but instead the es5ified version).

@ricardokdz @miketamis and @karltaylor Please let me know if any of you get a chance to try this out or can provide a repository where I can reproduce the issue so the fix can be confirmed.

@prescottprue
Copy link
Owner

prescottprue commented May 31, 2017

v1.5.0-beta also does not include the browser field, so it should respond the same way.

@stiofand
Copy link

I have the same error, im using react-dom 16 and no other library

@prescottprue
Copy link
Owner

@stevematdavies This issue is from a while back and should be solved by being up to date. A few questions would help me get to the bottm of it faster:

  • What version of react-redux-firebase are you using?
  • What does your .babelrc look like?
  • Are you npm linking?
  • What does your webpack/rollup config look like? (or your build setup if not using one of these)
  • Have you tried any of the examples or generator-react-firebase?

@ghost
Copy link

ghost commented Jan 12, 2018

https://webpack.js.org/configuration/externals/

try add prop-types library to external field.

@prescottprue
Copy link
Owner

@imdragonet Do you mean within react-redux-firebase or in an application using it?

From what I thought (could be totally wrong), it was supposed to be a dependency handled by any library using it instead of a peer dependency. Open to doing that though if it some are still seeing this issue.

@UbaidAhmedAwan
Copy link

Can anyone help me on this?

error: bundling failed: Error: Unable to resolve module ./factoryWithThrowingShims from /Users/ubaidahmedawan/Desktop/Tabedaar/tabedaar/node_modules/react-advanced-form/lib/index.development.js: The module ./factoryWithThrowingShims could not be found from /Users/ubaidahmedawan/Desktop/Tabedaar/tabedaar/node_modules/react-advanced-form/lib/index.development.js. Indeed, none of these files exist:

  • /Users/ubaidahmedawan/Desktop/Tabedaar/tabedaar/node_modules/react-advanced-form/lib/factoryWithThrowingShims(.native||.ios.js|.native.js|.js|.ios.json|.native.json|.json)
  • /Users/ubaidahmedawan/Desktop/Tabedaar/tabedaar/node_modules/react-advanced-form/lib/factoryWithThrowingShims/index(.native||.ios.js|.native.js|.js|.ios.json|.native.json|.json)
    at ModuleResolver.resolveDependency (/Users/ubaidahmedawan/Desktop/Tabedaar/tabedaar/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:167:697)
    at ResolutionRequest.resolveDependency (/Users/ubaidahmedawan/Desktop/Tabedaar/tabedaar/node_modules/metro/src/node-haste/DependencyGraph/ResolutionRequest.js:80:16)
    at DependencyGraph.resolveDependency (/Users/ubaidahmedawan/Desktop/Tabedaar/tabedaar/node_modules/metro/src/node-haste/DependencyGraph.js:237:485)
    at Object.resolve (/Users/ubaidahmedawan/Desktop/Tabedaar/tabedaar/node_modules/metro/src/lib/transformHelpers.js:116:25)
    at dependencies.map.result (/Users/ubaidahmedawan/Desktop/Tabedaar/tabedaar/node_modules/metro/src/DeltaBundler/traverseDependencies.js:298:29)
    at Array.map ()
    at resolveDependencies (/Users/ubaidahmedawan/Desktop/Tabedaar/tabedaar/node_modules/metro/src/DeltaBundler/traverseDependencies.js:294:16)
    at /Users/ubaidahmedawan/Desktop/Tabedaar/tabedaar/node_modules/metro/src/DeltaBundler/traverseDependencies.js:159:33
    at Generator.next ()
    at step (/Users/ubaidahmedawan/Desktop/Tabedaar/tabedaar/node_modules/metro/src/DeltaBundler/traverseDependencies.js:239:307)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants