问题描述
我正在克隆一个项目:
步骤如下:
- npm i
- react-native link
当我运行它 react-native run-ios
我遇到了 RCTWebSocket
库的问题。如果你在自定义编译器标志
中搜索一点只需要删除2个编译器标志就可以轻松解决这个问题。
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
.
稍后我再次运行 react-native run-ios
并且工作正常,但是当应用程序打开时,显示下一个错误:
Later just i run again react-native run-ios
and works fine, but when the app is open, show the next error:
搜索我发现与升级相关
,
但我正在使用该命令而不起作用。
but i'm using that command and not works.
我的反应信息:
react-native-cli: 1.0.0
react-native: 0.32.1
我在 Xcode 8
和ios 10.0中运行
更新:
UPDATES:
当另一个mac上的克隆工作时,我确保拥有相同版本的xcode和节点。
When clone on another mac works, I am ensuring to have the same versions of both xcode and node.
这可能是一些mac配置问题?
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
这会导致所有这些问题吗?
推荐答案
使用React 0.32~0.37:问题很可能是你使用的是React 15.4.x而不是15.3.x. 15.3和15.4之间的变化之一是 react / lib
下的许多模块被移动到 react-dom / lib
,这就是包装商无法找到 react / lib / ReactUpdates
的原因。
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
.
确保您的包裹.json文件锁定React to 15.3.x:
Ensure that your package.json file locks React to 15.3.x:
"dependencies": {
"react": "~15.3.2"
}
然后删除 node_modules
文件夹并再次运行 yarn
或 npm install
。验证您是否安装了React 15.3.x:
Then delete your node_modules
folder and run yarn
or npm install
again. Verify that you installed React 15.3.x:
$ npm ls react
[email protected] /code/app
└── [email protected]
最后,重新启动React Native服务器并加载再次捆绑。
Last, restart the React Native server and load your bundle again.
这篇关于无法解析模块react / lib / ReactUpdates的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!