React Native iOS项目编译报错:exit code 1及Bugsnag库缺失
React Native iOS构建报错:library not found for BugsnagReactNative
问题描述
从GitHub克隆React Native项目后,执行以下命令序列:
yarn install cd ios && pod install cd .. yarn ios
或直接执行react-native run-ios时,出现如下错误:
info Run CLI with --verbose flag for more details.
error Command failed with exit code 1.
此外,在Xcode中打开.xcworkspace文件时,还会触发错误:
library not found for BugsnagReactNative
项目的package.json内容如下:
{ "name": "proj", "version": "0.0.1", "private": true, "scripts": { "android": "react-native run-android", "ios": "react-native run-ios", "build": "CI= npm run build", "start": "react-native start", "test": "jest", "lint": "eslint ." }, "dependencies": { "@bugsnag/react-native": "^7.16.2", "@react-native-async-storage/async-storage": "^1.15.6", "@react-native-community/checkbox": "^0.5.8", "@react-native-community/datetimepicker": "^4.0.1", "@react-native-community/masked-view": "^0.1.11", "@react-native-community/netinfo": "^6.0.0", "@react-navigation/bottom-tabs": "^6.0.5", "@react-navigation/native": "^6.0.2", "@react-navigation/stack": "^6.0.7", "amazon-cognito-identity-js": "^5.1.0", "aws-amplify": "^4.2.4", "axios": "^0.21.1", "package": "^1.0.1", "prop-types": "^15.7.2", "react": "17.0.2", "react-native": "0.66.3", "react-native-carousel": "^0.12.0", "react-native-codegen": "^0.0.7", "react-native-collapsible": "^1.6.0", "react-native-date-picker": "^4.1.1", "react-native-dropdown-picker": "^5.1.23", "react-native-exit-app": "^1.1.0", "react-native-gesture-handler": "^1.10.3", "react-native-keyboard-aware-scroll-view": "^0.9.5", "react-native-mask-input": "^1.0.3", "react-native-modal-dropdown": "^1.0.1", "react-native-month-year-picker": "^1.8.0", "react-native-safe-area-context": "^3.3.0", "react-native-screens": "^3.13.1", "react-native-select-dropdown": "^1.1.0", "react-native-snap-carousel": "^3.9.1", "tcomb-form-native": "^0.6.20", "toggle-switch-react-native": "^3.2.0", "yarn": "^1.22.17" }, "devDependencies": { "@babel/core": "^7.15.0", "@babel/runtime": "^7.15.3", "@bugsnag/source-maps": "^2.3.1", "@react-native-community/eslint-config": "^3.0.0", "babel-core": "^7.0.0-bridge.0", "babel-jest": "26.6.3", "eslint": "7.32.0", "jest": "^27.0.6", "metro-react-native-babel-preset": "^0.66.2", "react-test-renderer": "17.0.2" }, "jest": { "preset": "react-native" } }
已尝试但无效的解决方法
- 执行
yarn add global @bugsnag/react-native-cli - 将rct-folly部署目标改为9.0
- 将Build Active architecture Only设置为Yes
- 在Xcode中安装iOS 13.0模拟器
- 删除Build Settings中的搜索路径,删除Pods文件夹后重新安装Pods
- 移除'Other Linker Flags'列表中除
$(inherited)外的所有内容(确保$(inherited)在顶部) - 执行
pod update - 重新安装ruby/gem
- 卸载并重新安装Cocoapods
- 执行
rm -rf node_modules、yarn cache clean - 删除podfile.lock和Pods,重新安装
- 执行
sudo arch -x86_64 gem install ffi、arch -x86_64 pod install - 卸载并重新安装watchman
- 检查node版本、React Native版本及Bugsnag版本
- 注释掉package.json中的Bugsnag依赖
- 多次重新安装项目
内容的提问来源于stack exchange,提问作者Sunyoung Ha
相关产品推荐
相关产品推荐

