新鲜反应原生项目失败:条目、":CFBundleIdentifier" 、不存在



我正在尝试通过简单地按照这里的指南来设置一个新的 React Native 项目:https://facebook.github.io/react-native/docs/getting-started

我可以很好地从 Xcode 构建和运行它,只得到一些"语义警告"。

但是,当我运行yarn react-native run-ios时,出现以下错误:

Leos-MacBook-Pro:citymysteryrn leo$ yarn react-native run-ios
yarn run v1.19.1
$ /Users/leo/Projekt/ReactNative/CityMysteryRN/node_modules/.bin/react-native run-ios
info Found Xcode workspace "CityMysteryRN.xcworkspace"
info Building (using "xcodebuild -workspace CityMysteryRN.xcworkspace -configuration Debug -scheme CityMysteryRN -destination id=85422E57-5311-43D4-9292-E02982FB7B67 -derivedDataPath build/CityMysteryRN")
..................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
info Installing "DerivedData/Build/Products/Debug-iphonesimulator/CityMysteryRN.app"
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
Failed to install the requested application
An application bundle was not found at the provided path.
Provide a valid path to the desired application bundle.
Print: Entry, ":CFBundleIdentifier", Does Not Exist
error Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier DerivedData/Build/Products/Debug-iphonesimulator/CityMysteryRN.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
. Run CLI with --verbose flag for more details.
Error: Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier DerivedData/Build/Products/Debug-iphonesimulator/CityMysteryRN.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
    at checkExecSyncError (child_process.js:621:11)
    at Object.execFileSync (child_process.js:639:15)
    at runOnSimulator (/Users/leo/Projekt/ReactNative/CityMysteryRN/node_modules/@react-native-community/cli-platform-ios/build/commands/runIOS/index.js:189:45)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async Command.handleAction (/Users/leo/Projekt/ReactNative/CityMysteryRN/node_modules/@react-native-community/cli/build/cliEntry.js:160:7)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

我知道有很多与此相关的问题(和答案(,但这似乎是一个非常广泛的问题,我无法解决。我已经尝试了大多数打印的东西:条目,":CFBundleIdentifier",不存在没有任何运气。

我还尝试将这个项目与我知道正在运行的旧 React Native 项目进行比较,并确定了以下差异,但不知道它们是否重要:

  • node_modules/react-native/中缺少文件夹third-party
  • 构建文件夹包含文件夹ios/build/MyProjectName包含Logsinfo.plist等,而较旧的项目将这些文件和文件夹直接放在ios/build/

这是yarn react-native info的输出

System:
    OS: macOS 10.15.1
    CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
    Memory: 296.96 MB / 8.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 12.13.1 - /var/folders/5k/d42fx4ms6pv83hp9q0f9xvh40000gn/T/yarn--1574448680125-0.03761777189202431/node
    Yarn: 1.19.1 - /var/folders/5k/d42fx4ms6pv83hp9q0f9xvh40000gn/T/yarn--1574448680125-0.03761777189202431/yarn
    npm: 6.12.1 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
  IDEs:
    Xcode: 11.2.1/11B500 - /usr/bin/xcodebuild
  npmPackages:
    @react-native-community/cli: ^2.9.0 => 2.10.0 
    react: 16.8.6 => 16.8.6 
    react-native: 0.60.5 => 0.60.5 
  npmGlobalPackages:
    react-native-git-upgrade: 0.2.7
    react-native: 0.53.3

/ios/MyProjectName/Info.plist中的CFBundleIdentifier如下所示:

<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>

这不是一个正确的解决方案,但是。

我受够了,备份了我的MacBook,把整个东西擦干净了。它现在可以工作了。

最新更新