在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 # -------------------------------------------
我没有在此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
Meabed.. 21
这是正确的答案:
1-您的POD文件顶部应包含此行
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
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 };
6-安装节点软件包yarn install
,您的Pod应该可以正常工作了!pod install --repo-update
祝您编码愉快!
这是正确的答案:
1-您的POD文件顶部应包含此行
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
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 };
6-安装节点软件包yarn install
,您的Pod应该可以正常工作了!pod install --repo-update
祝您编码愉快!