【发布时间】:2021-08-26 10:53:00
【问题描述】:
我正在开发一个现有的 ReactNative 项目以向 IOS 应用程序添加新功能。但我尝试使用“react-native run-ios”命令构建和运行 IOS 应用程序,但出现以下错误。
在 null.lock 处找不到“Podfile.lock”。你在 iOS 目录下运行过“pod install”吗?
为了解决这个问题,我首先在项目的 ios 文件夹中运行以下命令。
pod install
当我这样做时,我在控制台中收到以下错误。
[!] 在项目目录中找不到“Podfile”。
为了解决这个错误,我尝试了以下操作:
- 我运行“sudo gem install cocoapods”
- 然后在 ios 文件夹中运行“pod init”
- 然后我在 ios 文件夹中运行“pod install”
然后我得到以下错误:
[!] The target `xxxxxx xxxTests` is declared multiple times.
我删除了 Podfile 中的重复项并尝试再次运行 pod install。这次它运行但我收到以下警告。
[!] The Podfile does not contain any dependencies.
[!] Automatically assigning platform `iOS` with version `12.0` on target `Inventory Smart` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.
[!] Automatically assigning platform `tvOS` with version `12.0` on target `Inventory Smart-tvOS` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.
当我运行 react-native run-ios 时,出现以下错误。
错误在 null.lock 处找不到“Podfile.lock”。你在 iOS 目录下运行过“pod install”吗?
我该如何解决这个问题?
【问题讨论】:
标签: ios react-native cocoapods