本文介绍了main.jsbundle 不存在.这一定是 + echo 'react native 的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在 XCode9.2 上使用 Product > Archive 来归档我的 React Native 项目.但是 Xcode 产生这个错误:

I tried to archive my react native project using Product > Archive on XCode9.2. But Xcode produce this error:

File /Users/louis/Library/Developer/Xcode/DerivedData/Scavenger-evyvzocndqoghkclcbwewolywniz/Build/Products/Release-iphoneos/Scavenger.app/main.jsbundle does not exist. This must be a bug with


My Environment:
  OS: macOS Sierra 10.12.6
  Node: 9.3.0
  npm: 5.5.1
  Watchman: 4.7.0
  Xcode: Xcode 9.2 Build version 9C40b
  Android Studio: 3.0 AI-171.4443003

Packages: (wanted => installed)
  react: ^16.0.0 => 16.2.0
  react-native: ^0.50.3 => 0.50.4

我也尝试在终端上运行
react-native bundle --entry-file='index.ios.js' --bundle-output='./ios/Scavenger/main.jsbundle' --dev=false --platform='ios' --assets-dest='./ios' 但最终出现错误加载依赖图...JSON 输入意外结束

I also tried to run on terminal
react-native bundle --entry-file='index.ios.js' --bundle-output='./ios/Scavenger/main.jsbundle' --dev=false --platform='ios' --assets-dest='./ios'but ended up with error Loading dependency graph... Unexpected end of JSON input

XCode 错误.

推荐答案

这个问题需要几天时间才能解决.在 travis-ci 上运行构建时遇到了这个问题.这是我的修复:

This issue take me some days to fixed. I got this issue when run the build on travis-ci. Here is my fix:

将此行添加到 package.json 文件中的 scripts.

Add this line to scripts in your package.json file.

"build:ios": "react-native bundle --entry-file='index.js' --bundle-output='./ios/main.jsbundle' --dev=false --platform='ios'"

现在您可以运行命令来生成main.jsbundle.yarn build:iosnpm run build:ios

Now your can run the command to generate main.jsbundle. yarn build:ios or npm run build:ios

打开 Xcode > 选择项目目标 > 在 Build Phases 中将 main.jsbundle 添加到 Copy Bundle Resource.(下图).

Open the Xcode > Select project target > add main.jsbundle to Copy Bundle Resource in Build Phases. (image below).

这篇关于main.jsbundle 不存在.这一定是 + echo 'react native 的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 02:17