@Rookie
2020-08-03T12:30:21.000000Z
字数 1657
阅读 1430
reactnative
{
"name": "testReactNative",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start"
},
"dependencies": {
"react": "16.0.0-alpha.12",
"react-native": "0.45.1"
}
}
需要注意 react版本号 , 和 react-native 版本号
这里需要注意"react-native": "0.45.1", "react": "16.0.0-alpha.12", , 可能会报错,
修改成: "react": "16.0.0-alpha.6",
"react-native": "0.46.1"
有待测试
[!] Unable to find a specification for `Yoga (= 0.42.3.React)` depended upon by `React/Core`
# Your 'node_modules' directory is probably in the root of your project,
# but if not, adjust the `:path` accordingly
pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
pod 'React', :path => '../node_modules/react-native', :subspecs => [
'Core',
'RCTText',
'RCTNetwork',
'RCTWebSocket', # needed for debugging
# Add any other subspecs you want to use in your project
]
pod 'Yoga', :path =>
pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
pod请升级到1.2.1以上 ,
这里也可能是 react native 版本问题
更新gem:sudo gem update --system
删除gem源:gem sources --remove https://ruby.taobao.org/
修改gem源:gem sources -a https://gems.ruby-china.org
查看gem源是否是最新的:gem sources -l
升级cocoapods:sudo gem install -n /usr/local/bin cocoapods --pre
查看升级后的cocoapods版本:pod --version
卸载:sudo gem uninstall cocoapods
安装:sudo gem install cocoapods
安装特定版本:sudo gem install cocoapods -v 0.35.0
直接运行项目会报Could not connect to development server错误
解决方式:打开info.plist文件,添加下面配置即可:
如果有在 appdelegate崩溃处崩溃的, 可能也是因为没有允许 http 请求
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>
<dict>
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>