在将react native更新到v0.6.0之后,我收到了这些错误。我甚至尝试从头开始创建一个项目,但我仍然会遇到这些错误。其他人看到了吗?此代码以前有效。有什么办法解决这个问题吗?
错误:无法读取未定义的属性"None"堆栈:index.ios.bundle:24163需要索引.ios.bundle:244index.ios.bundle:23216需要索引.ios.bundle:244index.ios.bundle:1187需要索引.ios.bundle:244index.ios.bundle:1116需要索引.ios.bundle:244Object.ErrorUtils.applyWithGuard索引.ios.bundle:880需要索引.ios.bundle:195URL:未定义线:未定义消息:无法读取undefinedhandleException@index.ios.bundle:7033 的属性"None"
index.ios.bundle:35950使用appParams:{"rootTag":1,"initialProps":{}}运行应用程序"TestApp"DEV===true,开发级别警告开启,性能优化关闭
index.ios.bundle:7033错误:不变冲突:应用程序测试应用程序尚未注册。堆栈:Object.AppRegistry.run应用程序索引.ios.bundle:35957jsCall index.ios.bundle:7328MessageQueueMixin_callFunction index.ios.bundle:7591index.ios.bundle:7618index.ios.bundle:7612ReactDefaultBatchingStrategyTransaction.Mixin.perform index.ios.bundle:6143Object.ReactDefaultBatchingStrategy.batchedUpdates index.ios.bundle:13907Object.batchedUpdates index.ios.bundle:4686URL:未定义线:未定义消息:不变冲突:应用程序测试应用程序尚未注册。
我想我已经解决了这个问题。它与我正在使用的一个组件有关,在我的例子中是react-native-device
。要修复它,我必须删除位于组件中的node_modules
文件夹。AppName/node_modules/React-Native-Component/node_modules
。
我还更新了同样位于组件文件夹AppName/node_modules/React-Native-Component/package.json
中的package.json文件中的依赖项,并将react原生依赖项更改为(或类似的):
"peerDependencies": {
"react-native": ">= 0.4.0 < 1"
},
更新
您也可以尝试重新启动计算机。我注意到该节点开始打开多个进程,这可能会导致问题。
更新2
从项目根文件夹在终端中运行:
./node_modules/react-native/packager/packager.sh --reset-cache
以上所有修复的组合为我修复了它。希望这能帮助到别人。