react-everywhere/re-start

Doesn't work out of the box, `Module not found: 'react/lib/React'`

berstend opened this issue · 3 comments

Hi there,

after following the latest install-with-template instructions and running yarn run web the following error appears:

Failed to compile.

Error in ./~/react-dom/lib/ReactMount.js
Module not found: 'react/lib/React' in /Users/User/dev/testing/react-native/r10/node_modules/react-dom/lib

 @ ./~/react-dom/lib/ReactMount.js 1:156-182

Steps:

react-native init r10 --template everywhere
cd r10
node scripts/addDevDependencies.js
yarn run web

I thought that maybe react-dom is too old and upgraded to 16.0.0-alpha.12, which changed the error to:

Failed to compile.

Error in ./~/react-native-web/dist/modules/injectResponderEventPlugin.js
Module not found: 'react-dom/lib/EventPluginHub' in /Users/User/dev/testing/react-native/r10/node_modules/react-native-web/dist/modules

 @ ./~/react-native-web/dist/modules/injectResponderEventPlugin.js 1:20-59

Any idea where the issue might be?

I've added my current package.json here:
https://gist.github.com/berstend/02e2b3b8319a051f86353789afec6cff

Seems to be a compatibility issue with react-native-web. It is not ready for react 16 yet. Look at the note here.

Do tell me if this works for you. I'll update the dependencies and add a note in readme.

Great, thanks for the fast reply @amoghbanta

I've followed your instructions (as well as removing the yarn.lock file) and got this error:

Failed to compile.

Error in ./~/react-native-web/dist/index.js
Module build failed: ReferenceError: Unknown plugin "transform-react-remove-prop-types" specified in "/Users/User/dev/testing/react-native/r10/node_modules/react-native-web/package.json" at 0, attempted to resolve relative to "/Users/User/dev/testing/react-native/r10/node_modules/react-native-web"
    at Array.map (native)
 @ ./index.web.js 1:164-187

After adding babel-plugin-transform-react-remove-prop-types as dependency the above error was resolved and the demo runs smoothly now. 🎉

Thanks a lot!

I had the same issues with the fresh install. I'm currently trying to play with React 16 which was installed anyway as the dependency of react-native@0.49.3, so I have upgraded react-dom too. Have hit all these 3 errors, the final one being somethign wrong with the config in my understanding. So I had to add it to my dev dep too but that shouldn't be needed: necolas/react-native-web#607