Skip to content

Unable to resolve module react/lib/ReactComponentWithPureRenderMixin #923

@domisolo

Description

@domisolo

UnableToResolveError: Unable to resolve module react/lib/ReactComponentWithPureRenderMixin from /node_modules/react-navigation/src/views/Header.js

Activity

VictorVolovik

VictorVolovik commented on Apr 5, 2017

@VictorVolovik

Same issues with node 6.10.1, npm 4+, mac os.

hilkeheremans

hilkeheremans commented on Apr 5, 2017

@hilkeheremans

See #901 and after that see #908

tl;dr:
For now, use react-navigation's master branch here on github, and make sure you manually upgrade React to the dependency version specified by RN 0.43.

hilkeheremans

hilkeheremans commented on Apr 5, 2017

@hilkeheremans

Also linked to #906

ryanbennettvoid

ryanbennettvoid commented on Apr 5, 2017

@ryanbennettvoid

@hilkeheremans's tip fixed the issue.

In your package.json, replace the react-navigation dependency with this:

"react-navigation": "git+https://github.com/react-community/react-navigation.git"

then do npm install

Note: this is just a temporary fix.

thurt

thurt commented on Apr 6, 2017

@thurt

@ryanbennettvoid @hilkeheremans suggest you don't use master.

use the fix #809, commit hash 7edd9a7, until the next version is released.

"react-navigation": "git+https://github.com/react-community/react-navigation.git#7edd9a7"
joemckie

joemckie commented on Apr 6, 2017

@joemckie

Unfortunately, even with these fixes there are still plenty of Flow errors, e.g:

node_modules/react-navigation/src/views/CardStack.js:534
534:       <SceneView
           ^ property `navigation`. Property not found in
521:         <View style={styles.container}>
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ props of React element `View`

node_modules/react-navigation/src/views/CardStack.js:534
534:       <SceneView
           ^ property `screenProps`. Property not found in
521:         <View style={styles.container}>
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ props of React element `View`

Most of these are from the return type of _renderInnerCard.

Current specs:

- react-native: 0.43.2
- react-navigation: 1.0.0-beta.7
- flow-bin: 0.40.0
thurt

thurt commented on Apr 7, 2017

@thurt

note: the below comment only affects flow users

@joemckie Saw these errors as well. when i upgraded react-native to 0.43.1 using react-native-git-upgrade it appeared to bump my flow-bin version from 0.38.0 -> 0.40.0. before this upgrade i did not have flow errors coming from react-navigation.

Dhrin

Dhrin commented on Apr 7, 2017

@Dhrin

This work on me

"react": "16.0.0-alpha.3",
"react-native": "0.43.2",
"react-navigation": "git+https://github.com/react-community/react-navigation.git#7edd9a7"

then

rm -rf node_modules && npm install

Clean ios/android build folder:

rm -rf android/build && rm -rf ios/build

After that, just run as usual:

react-native run-ios or react-native run-android

joemckie

joemckie commented on Apr 7, 2017

@joemckie

@thurt yeah it looks like there may have been some changes in how the React$Element or React$Class type is handled in between those versions? If it's not on the radar of the maintainers I'll take a look into it when I get a chance.

JeyWong

JeyWong commented on Apr 8, 2017

@JeyWong

这应该是v1.0.0-beta.7版本的小错误,忘记清除不必要的代码。Header.js中引入了ReactComponentWithPureRenderMixin,但后面未发现对这个引入的使用,只需要删除第12行的代码即可,亲测有效!
Delete node_modules\react-navigation\src\views\Header.js line 12 codes:
import ReactComponentWithPureRenderMixin from 'react/lib/ReactComponentWithPureRenderMixin';

30 remaining items

Chandhru08

Chandhru08 commented on Apr 22, 2017

@Chandhru08

Guys, Im also facing the below error while trying to build an android app :
UnableToResolveError: Unable to resolve module react/lib/ReactComponentWithPureRenderMixin from c:\Users\chand\manager\node_modules\react-addons-pure-render-mixin\index.js: Module does not exist in the module map or in these directories:
c:\Users\chand\manager\node_modules\react\lib
, c:\Users\chand\node_modules\react\lib

I confused by reading all over the top to bottom in this page.

Can anybody explain what steps needs to be followed in short?

Chandhru08

Chandhru08 commented on Apr 23, 2017

@Chandhru08

What is going on. Why Grabbou is creating a loop between #1181 and #923 ?

jamieparkinson

jamieparkinson commented on Apr 23, 2017

@jamieparkinson

@Chandhru08 github is just automatically noting that he referenced this in another issue 🙂

In short, you just need to update your dependency (for react-navigation) to something a bit more recent than the current release that's on NPM - for example, see #923 (comment)

Chandhru08

Chandhru08 commented on Apr 23, 2017

@Chandhru08

@jamieparkinson
Thank you for explaining.

I just have this confusion now, do I have to remove other dependency items which are present in Package.json file or should I add it with existing items?

jamieparkinson

jamieparkinson commented on Apr 23, 2017

@jamieparkinson

Just replace the react-navigation item, that should be sufficient. So somewhere under dependencies you'll have something like:

"react-navigation": "1.0.0-beta.7",

And that needs to be replaced with, for example:

"react-navigation": "git+https://github.com/react-community/react-navigation.git#7edd9a7",

Then you can follow the other steps in #923 (comment). I hope that works OK for you!

shooterRao

shooterRao commented on Apr 24, 2017

@shooterRao

Today I have encountered the same problem,Later, I found React-navigation": "1.0.0-beta.7 is not supported react-native version 0.43.4,so you can modify "react-native": "0.43.3" in package.json,
then

  1. rm -rf node_modules && npm install ,
  2. rm -rf android/build && rm -rf ios/build ,
    3.react-native run-ios or react-native run-android
    thank you very much @Dhrin
wswoodruff

wswoodruff commented on Apr 26, 2017

@wswoodruff

Setting

"react-navigation": "git+https://github.com/react-community/react-navigation.git#7edd9a7",

like @jamieparkinson said in my package.json just fixed a slew of errors that just attacked me, and none of them looked related. Involved LinkedStateMixin, ReactComponentTreeHook, it was just weird.

And I got down this entire rabbit hole over trying to use < FlatList >

epinapala

epinapala commented on Apr 26, 2017

@epinapala

Finally the below worked for me :

    "react": "16.0.0-alpha.6",

    "react-native": "0.43.4",

    "react-navigation": "git+https://github.com/react-community/react-navigation.git#7edd9a7"

followed by rm -rf node_modules && npm install

lifez

lifez commented on Apr 26, 2017

@lifez

Same here with

 "dependencies": {
    "react": "16.0.0-alpha.6",
    "react-native": "^0.43.3",
    "react-navigation": "1.0.0-beta.8"
  }

and

"dependencies": {
    "react": "16.0.0-alpha.6",
    "react-native": "^0.43.3",
    "react-navigation": "git+https://github.com/react-community/react-navigation.git#7edd9a7"
  }

Already try with react-native 0.43.4 got the same error

manan

manan commented on Apr 26, 2017

@manan

@lifez I am using the latter with 0.43.4 and it works fine!

Did you try:
rm -rf node_modules && npm install

And then reloading the screen multiple times?

benjick

benjick commented on Apr 26, 2017

@benjick

Why not just publish a new release to NPM with this cherrypicked?

How do I do this with yarn? Changed package.json, deleted my lockfile, re-installed but still the same problem

grabbou

grabbou commented on Apr 26, 2017

@grabbou

New release will be published today containing a fix.

I am going to lock this issue to prevent unnecessary notifications.

locked and limited conversation to collaborators on Apr 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @jaygarcia@benjick@RWOverdijk@epinapala@nonameolsson

        Issue actions

          Unable to resolve module `react/lib/ReactComponentWithPureRenderMixin` · Issue #923 · react-navigation/react-navigation