【问题标题】:React-Native (Build-Failed)React-Native(构建失败)
【发布时间】:2018-01-07 21:00:51
【问题描述】:

我正在尝试构建一个 React Native 应用程序,但我似乎总是遇到许多开发人员目前面临的相同问题。创建应用后

  1. react-native init HelloWorld
  2. cd HelloWorld
  3. react-native run-ios(进入终端)

会弹出这样的错误并终止运行:

** BUILD FAILED **


The following commands produced analyzer issues:
	Analyze /Users/JemmaMarie/Documents/CareerCenter/Exercises/Ex_Files_Learning_React_Native/Exercise\ Files/Ch02/start/HelloWorld/node_modules/react-native/ReactCommon/yoga/yoga/YGNodeList.c
	Analyze /Users/JemmaMarie/Documents/CareerCenter/Exercises/Ex_Files_Learning_React_Native/Exercise\ Files/Ch02/start/HelloWorld/node_modules/react-native/ReactCommon/yoga/yoga/Yoga.c
(2 commands with analyzer issues)

The following build commands failed:
	PhaseScriptExecution Install\ Third\ Party /Users/JemmaMarie/Documents/CareerCenter/Exercises/Ex_Files_Learning_React_Native/Exercise\ Files/Ch02/start/HelloWorld/ios/build/Build/Intermediates/React.build/Debug-iphonesimulator/double-conversion.build/Script-190EE32F1E6A43DE00A8543A.sh
(1 failure)

Installing build/Build/Products/Debug-iphonesimulator/HelloWorld.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

Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/HelloWorld.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist

我已经从堆栈溢出尝试了这些解决方案,但没有运气: 环境:

节点:8.2.1 守望者:4.7.0 代码:8.3.3 反应原生 cli:2.0.1 反应原生:未知

  1. 升级的 xCode 现在版本 8.3.2

  2. 升级 react native 并再次运行 react native run-ios

  3. 进入系统偏好设置并在 xcode IDE 上选择 xcode 版本

  4. 我删除了 node_modules 以查找另一个人发现并运行 react-native run-ios 但仍然无法正常工作的“错字”

  5. 尝试使用 rm -r 删除构建文件夹 ios/build 并运行 react-native run-ios

  6. 按照https://github.com/facebookincubator/create-react-app的步骤尝试了另一个样板create-react-native-app HelloWorld

但得到这个错误:

module.js:487
    throw err;
    ^

Error: Cannot find module 'semver'
    at Function.Module._resolveFilename (module.js:485:15)
    at Function.Module._load (module.js:437:25)
    at Module.require (module.js:513:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/unsupported.js:2:14)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)

到目前为止,有没有人找到一个相当可靠的解决方案?

提前致谢。

【问题讨论】:

  • 试试这个:npm install --save semver
  • 这给了我上面相同的错误^。安装 semver 对你有用吗?

标签: javascript ios reactjs react-native mobile-application


【解决方案1】:

好的。我遇到了同样的错误,我已经发布了我的答案here

在尝试解决方案之前,您应该阅读 cmets,因为它们可能对您有所帮助。

【讨论】:

  • 谢谢!愚蠢的问题:您是否将下载的文件拖到那里,或者您是否找到了最初在第三方文件夹中的特定文件并替换了它?
  • 是的,我已经用下载文件替换了文件
  • 好的,我把所有东西都拖进去了,但它给了我同样的错误。 :(
  • 是的,在我替换了第三方中的文件并删除了构建的内容后,我再次遇到了同样的错误。
  • 我很抱歉,因为它对我有用,另外一个也可以,你可以通过删除节点模块并再次重复该过程来再次使用它。谢谢
【解决方案2】:

所以我决定跳过 Xcode 路线并使用不同的样板及其对应的 Expo 应用程序。

https://github.com/react-community/create-react-native-app

在您喜欢的 IDE 上打开文件

然后运行:npm run ios 在你的终端上

您仍然可以使用 Xcode 模拟器。它应该会自动打开:)

感谢您为我上一期提供的时间和意见!

【讨论】:

    【解决方案3】:

    在使用 brew 升级到 watchman 4.7.0 后遇到了类似问题。

    这个新版本的守望者似乎存在问题: watchman issues 358.

    最后,我解决了删除/usr/local/var/run/watchman/ 文件夹的内容的问题。

    【讨论】:

      【解决方案4】:

      我遇到了这个错误,我通过了这些步骤,终于成功构建了。

      1) delete 'ios' and 'android' folder.
      2) delete 'node_module'
      3) npm i
      4) react-native eject
      5) react-native-git-upgrade  #this step is important
      6) react-native run-ios
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2018-03-08
        • 2019-03-21
        • 2019-06-06
        • 2015-05-31
        • 2019-08-16
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多