React-Native运行报错

运行命令

puyarn先安装依赖, 进入到ios文件中, pod install 安装ios的依赖, 退出ios,yarn ios运行项目   

yarn && cd ios && pod install && cd .. && yarn ios

yarn ios运行比较慢 耐心等待 结果报错或者正常运行

删除依赖包括两部分 node-module和ios文件中 Podfile.lock文件

重新运行

  1. rm -rf node_modules
  2. npm cache clean --force

  1. npm install
  2. cd ios && pod install

运行报错

2.1 react-native-video 报错

运行 react-native unlink react-native-video

2.2 pod install 报错

pod install --repo-update 多次尝试直到成功

(移动开发知识)pod install LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 60_什么课程值得买

2.3 ios打包上架后 yarn ios运行报错

The following build commands failed:

CpResource /Users/zhangfuqiang/Desktop/app/mingshigongpei/release_ios/main.jsbundle /Users/zhangfuqiang/Library/Developer/Xcode/DerivedData/msgp-aytniufprlayvpdioxbnqjesqglt/Build/Products/Debug-iphonesimulator/msgp.app/main.jsbundle

CpResource /Users/zhangfuqiang/Desktop/app/mingshigongpei/release_ios/assets /Users/zhangfuqiang/Library/Developer/Xcode/DerivedData/msgp-aytniufprlayvpdioxbnqjesqglt/Build/Products/Debug-iphonesimulator/msgp.app/assets

原因:ios文件下project.pbxproj 寻找release_ios找不到 release_ios是ios上架需要生成的文件

解决办法 手动创建release_ios 执行打包命令 react-native bundle --entry-file index.js --bundle-output release_ios/main.jsbundle --assets-dest release_ios/
打包完成后 yarn ios运行成功

2.4 模拟机启动报错 No bundle URL present

 

解决方法 add this on info.plist:

<key>NSAppTransportSecurity</key>
<dict>
  <key>NSAllowsArbitraryLoads</key>
<true/>
  <key>NSAllowsArbitraryLoadsInWebContent</key>
<true/>
  <key>NSAllowsLocalNetworking</key>
<true/>
  </dict>

参考链接

ios - What is the meaning of 'No bundle URL present' in react-native? - Stack Overflow

2.5 报错error code 65

info Found Xcode workspace "msgp.xcworkspace"
`instruments` is now deprecated in favor of 'xcrun xctrace' (see `man xctrace` for more information on its replacement)
info Building (using "xcodebuild -workspace msgp.xcworkspace -configuration Debug -scheme msgp -destination id=2c3b267709714d0a8d664b33d1ede1d59ac14aff")
(node:20534) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening msgp.xcworkspace. Run CLI with --verbose flag for more details.
Command line invocation:
    /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace msgp.xcworkspace -configuration Debug -scheme msgp -destination id=2c3b267709714d0a8d664b33d1ede1d59ac14aff

User defaults from command line:
    IDEPackageSupportUseBuiltinSCM = YES

note: Using new build system
note: Building targets in parallel
note: Planning build
note: Analyzing workspace
note: Constructing build description
note: Build preparation complete
/Users/zhangfuqiang/Desktop/app/xiaobai/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 7.0, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target 'RNSound' from project 'Pods')
/Users/zhangfuqiang/Desktop/app/xiaobai/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target 'react-native-orientation-locker' from project 'Pods')
/Users/zhangfuqiang/Desktop/app/xiaobai/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 7.0, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target 'RNThumbnail' from project 'Pods')
/Users/zhangfuqiang/Desktop/app/xiaobai/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 7.0, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target 'BVLinearGradient' from project 'Pods')
/Users/zhangfuqiang/Desktop/app/xiaobai/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target 'react-native-nodemediaclient' from project 'Pods')
/Users/zhangfuqiang/Desktop/app/xiaobai/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target 'react-native-video' from project 'Pods')
/Users/zhangfuqiang/Desktop/app/xiaobai/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target 'RNFS' from project 'Pods')
error: Signing certificate is invalid. Signing certificate "Apple Development: Ruiyun Zhang (596C8ABNQ7)", serial number "<DVTSigningCertificateSerialNumber: 0x7fde6a06f960>", is not valid for code signing. It may have been revoked or expired. (in target 'msgp' from project 'msgp')
/Users/zhangfuqiang/Desktop/app/xiaobai/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target 'boost-for-react-native' from project 'Pods')
/Users/zhangfuqiang/Desktop/app/xiaobai/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target 'TZImagePickerController' from project 'Pods')
/Users/zhangfuqiang/Desktop/app/xiaobai/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 7.0, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target 'RNSyanImagePicker' from project 'Pods')


** BUILD FAILED **

解决办法

xcode - The iOS Simulator deployment targets is set to 7.0, but the range of supported deployment target version for this platform is 8.0 to 12.1 - Stack Overflow

post_install do |installer|
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
      end
    end
  end

2.6报错 react-native-fetch-blob

worked for me thanks, run grep -rl "s.dependency 'React/Core'" node_modules/ | xargs sed -i '' 's=React/Core=React-Core=g' and run pod update

https://github.com/joltup/rn-fetch-blob/pull/397

2.7 react-native-image-picker 报错

Converting image (iOS) URI from react-native-image-picker to path using rn-fetch-blob - Stack Overflow

2.8签名报错

error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening msgp.xcworkspace. Run CLI with --verbose flag for more details.
Command line invocation:
    /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace msgp.xcworkspace -configuration Debug -scheme msgp -destination id=2c3b267709714d0a8d664b33d1ede1d59ac14aff

User defaults from command line:
    IDEPackageSupportUseBuiltinSCM = YES

note: Using new build system
note: Building targets in parallel
note: Planning build
note: Analyzing workspace
note: Constructing build description
note: Build preparation complete
error: Signing certificate is invalid. Signing certificate "Apple Development: Ruiyun Zhang (596C8ABNQ7)", serial number "<DVTSigningCertificateSerialNumber: 0x7f96e55c52a0>", is not valid for code signing. It may have been revoked or expired. (in target 'msgp' from project 'msgp')

2.9 trunk下载失败

Unable to add a source with url `https://cdn.cocoapods.org/` named `trunk`.
You can try adding it manually in `/Users/zhangfuqiang/.cocoapods/repos` or via `pod repo add`.

解决办法:podfile文件中增加

source 'https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git'

[!] CDN: trunk Repo update failed&[!] CDN: trunk URL couldn't be downloaded: - Dev_survivorsfyh的博客-CSDN博客

ios 真机调试

获取uiud

iPhone手机轻松获取UDID的六种方式 - 简书

公司手机 iPhone7Plus:

uiud2c3b267709714d0a8d664b33d1ede1d59ac14aff

真机调试

// 1、通过“设备名称”运行
react-native run-ios --device "iPhone的名字"

// 2、通过“udid”运行
react-native run-ios --udid "iPhone的udid"

【React Native 学习】mac 采用模拟器、真机调试 - 简书

npm install -g ios-deploy报错

解决方法

sudo chown -R $USER /usr/local/lib/node_modules

输入开机密码

How to fix the "Missing write access" error when using npm

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值