prescottprue / react-redux-firebase

Redux bindings for Firebase. Includes React Hooks and Higher Order Components.
https://react-redux-firebase.com
MIT License
2.55k stars 554 forks source link

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

Closed karltaylor closed 7 years ago

karltaylor commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

@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 commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

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

Can anyone provide a repo where this can be reproduced?

prescottprue commented 7 years ago

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 commented 7 years ago

i have the same problem using react and react native

miketamis commented 7 years ago

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 commented 7 years ago

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

ricardokdz commented 7 years ago

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

prescottprue commented 7 years ago

@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 commented 7 years ago

@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 commented 7 years ago

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 commented 7 years ago

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

stiofand commented 7 years ago

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

prescottprue commented 7 years ago

@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:

ghost commented 6 years ago

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

try add prop-types library to external field.

prescottprue commented 6 years ago

@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 commented 6 years ago

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: