M1芯片Mac使用Xcode12.5.1运行项目报library not found for -lBVLinearGradient错误
M1芯片Mac运行RN项目lBVLinearGradient链接报错解决方案
报错原文
ld: library not found for -lBVLinearGradient
clang: error: linker command failed with exit code 1 (use -v to see invocation)
适用场景
搭载M1芯片的Macbook Pro设备,Xcode 12.5.1版本,项目依赖react-native-linear-gradient@2.5.6
修复步骤
- 打开Xcode项目,进入对应TARGETS的Build Settings页,搜索Library Search Paths,确保配置项中存在
$(inherited),属性设置为递归(recursive) - 清理本地缓存文件:删除项目根目录下的
node_modules文件夹、ios目录下的Pods文件夹与Podfile.lock文件 - 重新安装依赖:在项目根目录执行
yarn install或npm install - 适配M1架构执行pod安装:进入ios目录,执行
arch -x86_64 pod install - 清空Xcode编译缓存:按下
Command + Shift + K,之后重新运行项目即可
备选临时修复方案
如果上述操作后仍存在报错,可降级依赖版本解决:
- 执行
yarn add react-native-linear-gradient@2.5.3安装兼容版本,重新执行pod安装步骤后运行项目
内容的提问来源于stack exchange,提问作者Shubham Bisht
相关产品推荐
相关产品推荐

