我想创建一个React Native Firebase项目。但是,当我遵循https://invertase.io/oss/react-native-firebase/quick-start/new-project中的设置说明并运行以下命令时,我无法解决一些cocoapod错误。我尝试运行以下命令:
npx react-native init --template = @ react-native-firebase / template HelloApp
✔ Downloading template ✔ Copying template ✔ Processing template ⠏ Installing CocoaPods dependencies (this may take a few minutes)internal/modules/cjs/loader.js:979 throw err; ^
Error: Cannot find module '/Users/me/Desktop/HelloApp/ios/undefined'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:976:15)
at Function.Module._load (internal/modules/cjs/loader.js:859:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47 { code: 'MODULE_NOT_FOUND', requireStack: [] }
✖ Installing CocoaPods dependencies (this may take a few minutes) error Error: Failed to install CocoaPods dependencies for iOS project, which is required by this template. Please try again manually: "cd ./HelloApp/ios && pod install". CocoaPods documentation: https://cocoapods.org/
我试图手动安装可可粉虱:
cd ./HelloApp/ios && pod安装
> > internal/modules/cjs/loader.js:979 throw err; ^
> >
> > Error: Cannot find module '/Users/me/Desktop/HelloApp/ios/undefined'
> > at Function.Module._resolveFilename (internal/modules/cjs/loader.js:976:15)
> > at Function.Module._load (internal/modules/cjs/loader.js:859:27)
> > at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
> > at internal/main/run_main_module.js:17:47 { code: 'MODULE_NOT_FOUND', requireStack: [] }
> >
> > [!] Invalid `Podfile` file: 767: unexpected token at ''.
> >
> > # from /Users/me/Desktop/HelloApp/ios/Podfile:46 #
> > ------------------------------------------- #
> > > use_native_modules! # end # -------------------------------------------
然后我尝试更新Cocoapod:
pod安装--repo-update
internal/modules/cjs/loader.js:979 throw err; ^
Error: Cannot find module '/Users/me/Desktop/HelloApp/ios/undefined'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:976:15)
at Function.Module._load (internal/modules/cjs/loader.js:859:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47 { code: 'MODULE_NOT_FOUND', requireStack: [] }
[!] Invalid `Podfile` file: 767: unexpected token at ''.
# from /Users/me/Desktop/HelloApp/ios/Podfile:46 #
------------------------------------------- #
> use_native_modules! # end # -------------------------------------------
但是他们没有一个能够解决cocoapod错误。如何正确安装Firebase模板?