[英]Unable to Pod Install on a brand new React Native Project
Question title explains most of the issue.问题标题解释了大部分问题。 I am running on an M1 Mac, and after following all of the instructions here , I am unable to run any form of
pod install
.我在 M1 Mac 上运行,按照此处的所有说明操作后,我无法运行任何形式的
pod install
。 When I do, I am given the following error...当我这样做时,出现以下错误...
[!] Invalid `Podfile` file: undefined local variable or method
`min_ios_version_supported' for #<Pod::Podfile:0x000000010ed18c60>.
I've tried running bundle install
followed by bundle exec pod install
, but I am faced then with the same error.我试过先运行
bundle install
,然后运行bundle exec pod install
,但我遇到了同样的错误。
I use yarn instead of npm, I've tried removing the node_modules
and running yarn cache clean
as per some other answer on this site, though I did not truly expect those to work.我使用 yarn 而不是 npm,我已经尝试删除
node_modules
并按照该站点上的其他答案运行yarn cache clean
,尽管我并不真正期望这些工作。
Additionally, my Podfile
does contain the needed imports at the top of the file...此外,我的
Podfile
确实在文件顶部包含了所需的导入……
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
I've even tried to just manually enter a min_ios_version_supported
at 12.4
because that is what my most recent project is working on.我什至尝试在
12.4
手动输入min_ios_version_supported
,因为这是我最近的项目正在进行的工作。 That gave me a different error, which I fixed again with a manual value entry, but that gave me a different more complicated error, essentially telling me I am better off actually solving the issue instead of patching it.这给了我一个不同的错误,我用手动值输入再次修复了这个错误,但这给了我一个不同的更复杂的错误,基本上告诉我最好实际解决问题而不是修补它。
Finally, I've tried adding the react-native.config.js
file.最后,我尝试添加
react-native.config.js
文件。 Still receiving the same error仍然收到相同的错误
I've made plenty of React Native projects before, and noticed that this Podfile
on my brand new project looks very different than Podfile
s I've used in the past-- am I on a new version of React that is not yet optimized?我之前做过很多 React Native 项目,并注意到我全新项目中的这个
Podfile
看起来与我过去使用的Podfile
非常不同——我是在使用尚未优化的新版本 React 吗?
At Podfile, min_ios_version_supported is in在 Podfile 中, min_ios_version_supported在
require_relative '../node_modules/react-native/scripts/react_native_pods'
So, in '../node_modules/react-native/scripts/react_native_pods' , you change at line 29:因此,在'../node_modules/react-native/scripts/react_native_pods'中,您在第 29 行更改:
def min_ios_version_supported
return '12.4'
end
to到
def min_ios_version_supported
return '13.0'
end
After that, delete Podfile.lock, Pods and pod install again!之后,删除Podfile.lock、Pods和pod install重新安装!
Good luck!祝你好运!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.