Cor*_*son 14 ios cocoapods react-native react-native-ios
在ios /目录中的我的react-native项目(react-native@0.60)中,我运行pod install并得到以下错误:
[!] Invalid `Podfile` file: no implicit conversion of nil into String.
# from /Users/coryrobinson/projects/hhs2/ios/Podfile:37
# -------------------------------------------
#
> use_native_modules!
# end
# -------------------------------------------
Run Code Online (Sandbox Code Playgroud)
我没有在此Podfile中添加或更改任何内容-它们都是react-native生成的。(我没有iOS开发经验,所以这可能是一个简单的解决方法,我只是不知道要寻找什么:-|)感谢您的帮助!
这是我的Podfile
platform :ios, '9.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
target 'hhs2' do
# Pods for hhs2
pod 'React', :path => '../node_modules/react-native/'
pod 'React-Core', :path => '../node_modules/react-native/React'
pod 'React-DevSupport', :path => '../node_modules/react-native/React'
pod 'React-fishhook', :path => '../node_modules/react-native/Libraries/fishhook'
pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
pod 'React-RCTWebSocket', :path => '../node_modules/react-native/Libraries/WebSocket'
pod 'RNFS', :path => '../node_modules/react-native-fs'
pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
target 'hhs2Tests' do
inherit! :search_paths
# Pods for testing
end
use_native_modules!
end
target 'hhs2-tvOS' do
# Pods for hhs2-tvOS
target 'hhs2-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
end
Run Code Online (Sandbox Code Playgroud)
Mea*_*bed 21
这是正确的答案:
1-您的POD文件顶部应包含此行
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
Run Code Online (Sandbox Code Playgroud)
2-确保您的package.json和node_module文件夹已安装此模块
cli-platform-ios/native_modules
3-如果在运行后未找到,则yarn install表示您的计算机中有旧的高速缓存node_modules,您需要先清理它,然后再重新安装该软件包。
4-清理缓存 yarn cache clean
5-确保您拥有此文件react-native.config.js且其配置为有效-并且它不存在不存在的NPM软件包-此步骤是最后且主要是错误原因
我的例子 react-native.config.js
module.exports = {
project: {
ios: {},
android: {},
},
assets: ['./assets/fonts/']
dependencies: {}, // make sure this deps are all valid installed packages or empty if you don't need it
};
Run Code Online (Sandbox Code Playgroud)
6-安装节点软件包yarn install,您的Pod应该可以正常工作了!pod install --repo-update
祝您编码愉快!
将@react-native-community/cli-platform-ios 从 3.1.0 降级到 3.0.0 并且它起作用了。
添加
"@react-native-community/cli-platform-ios": "3.0.0"
Run Code Online (Sandbox Code Playgroud)
到 package.json。
运行 npm install 然后 pod install 让它再次工作。
验证您的package.json@react-native-community/cli-platform-ios中是否有 ,
如果你不运行:
npm install @react-native-community/cli-platform-ios
然后
cd ios && pod install
如果您正在使用
pod install --project-directory=ios
Run Code Online (Sandbox Code Playgroud)
您可能需要通过替换来调整 Podfile
use_native_modules!
到
use_native_modules!(".")
也许这种行为将来会得到改善,我打开了一个关于它的问题https://github.com/react-native-community/cli/issues/657
| 归档时间: |
|
| 查看次数: |
8553 次 |
| 最近记录: |