1. http://docs.easemob.com/im/react-native/ios-app 按照环信官方文档集成React Native 的时候,如果执行命令时报“CFBundleIdentifier” Does Not Exist这个错误
于是参考官方第4步先配置Xcode。 配置完成之后运行webstorm发现出现如下:error
Unable to resolve module react-native/Libraries/Core/Devtools/parseErrorStack from /Users/dujiepeng/Enjoy/work/webim-react-native/node_modules/reactotron-react-native/dist/index.js: Module does not exist in the module map or in these directories:
/Users/dujiepeng/Enjoy/work/webim-react-native/node_modules/react-native/Libraries/Core/Devtools
This might be related to #4968
To resolve try the following:
Clear watchman watches: watchman watch-del-all.
Delete the node_modules folder: rm -rf node_modules && npm install.
Reset packager cache: rm -fr $TMPDIR/react-* or npm start -- --reset-cache.
RCTFatal + 104
-[RCTBatchedBridge stopLoadingWithError:] + 1138
__25-[RCTBatchedBridge start]_block_invoke_2 + 65
_dispatch_call_block_and_release + 12
_dispatch_client_callout + 8
_dispatch_main_queue_callback_4CF + 1054
CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 9
__CFRunLoopRun + 2205
CFRunLoopRunSpecific + 420
GSEventRunModal + 161
UIApplicationMain + 159
main + 111
start + 1
0x0 + 1
react-native-cli: 2.0.1
react-native: 0.36.1
猜想可能问题如下:
这段代码启动了两次, 在运行webstorm之后关闭弹出来的终端,于是程序能正常跑起来
2.试了环信的demo出现问题之后,在运行之前可以运行的工程 出现这种情况
这个问题大概是因为Importing components changed, should not use require anymore, try: import metagetplus from ('meta-extractor'),问了人说"却依赖 —服务器没打开 或者程序错误",我的解决方法是按照环信文档上配置下Xcode, 也就是第一个问题解决之后,在运行之前新创建的这个项目也能正常运行了
3.Element type is invalid…:
错误描述:
Element type is invalid: expected a String(for built-in components) or a class/function(for composite components) but got:object. check the render method of ‘….’
ES5 语法 导出模块
module.exports = Page2;
ES5语法 引入模块
var NaviBar = require('./NaviBar');
ES6 导出语法
export default class Page2 extends Component {
ES6 语法 导入模块
import NaviBar from './NaviBar';
两种语法混乱使用, 比如用ES6 导出 用ES5导入, 就可能会产生上述错误
cannot call a class as a function
这个错误一般情况下是不好找的,可以看到 错误详情第二部分指向的是ImageEquallyEnlarge.js 中的第11行,但是
错误地方一般不是第11行导致的,而产生的错误恰恰是因为这处我不小心写错了一个单词,propTypes写成了prototype
这样就导致了上面的错误。 有时候越是粗心犯的错误越是不好解决, 大家开发的时候一定要细心。
5.
这种错误出现情况如下:
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>
Welcome to React Native!
</Text>
<Text style={}> //这里没有写styles.welcome或者container 从而会报错
To get started, edit index.ios.js
</Text>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
});
然后在 输入 npm start. 去运行就行了!!