Unable to resolve module react/lib/ReactUpdates

2019-03-18 06:30发布

I'm cloning a proyect:

The steps are:

  • npm i
  • react-native link

When i run it react-native run-ios i have a problem with RCTWebSocket library. This problem is easy to resolve if you search a little just need remove 2 compiler flags, in Custom Compiler Flags.

Later just i run again react-native run-ios and works fine, but when the app is open, show the next error:

enter image description here

Searching i found that is related to upgrade, source here

but i'm using that command and not works.

When this command is executed, it starts showing me some overrides to some files and at the end of this process, the problem persists.

My react info:

react-native-cli: 1.0.0
react-native: 0.32.1

I'm running in Xcode 8 and ios 10.0

PDTA: When I start a new project works perfect

UPDATES:

When clone on another mac works, I am ensuring to have the same versions of both xcode and node.

Could it be some mac configuration problem?

The only difference between the 2 macs is the cli version:

`react-native-cli: 1.1.0` --> my mac
`react-native-cli: 1.2.0` --> the other mac

Will this be enough to cause all this problem?

2条回答
一纸荒年 Trace。
2楼-- · 2019-03-18 07:04

This has been fixed!

Update your dependencies and use react-native ^0.38.0 or newer.

Run react-native upgrade after all react-native version upgrades.

查看更多
手持菜刀,她持情操
3楼-- · 2019-03-18 07:18

With React 0.32~0.37: The problem is most likely that you are using React 15.4.x instead of 15.3.x. One of the changes between 15.3 and 15.4 was that many of the modules under react/lib were moved to react-dom/lib, which is why the packager can't find react/lib/ReactUpdates.

Ensure that your package.json file locks React to 15.3.x:

"dependencies": {
  "react": "~15.3.2"
}

Then delete your node_modules folder and run yarn or npm install again. Verify that you installed React 15.3.x:

$ npm ls react
app@1.0.0 /code/app
└── react@15.3.2

Last, restart the React Native server and load your bundle again.

查看更多
登录 后发表回答