React Native打离线包

记录下iOS打离线包遇到的问题。

新建React Native工程:react-native init TwoProject --version 0.44.3。此时如果报错:

Command `yarn add [email protected] --exact` failed.
yarn add v0.27.5
info No lockfile found.
[1/4] Resolving packages...
warning react-native > [email protected]: connect 2.x series is deprecated
error An unexpected error occurred: "https://registry.yarnpkg.com/art: ETIMEDOUT".
info If you think this is a bug, please open a bug report with the information provided in "/Users/xhqb/Documents/RNDemo/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
image

需要重新设置镜像。

npm config set registry https://registry.npm.taobao.org
npm config set disturl https://npm.taobao.org/dist

执行react-native init TwoProject --version 0.44.3。
image

执行打包命令。react-native bundle --entry-file index.ios.js --bundle-output ./ios/bundle/index.ios.jsbundle --platform ios --assets-dest ./ios/bundle --dev false,此时报错,ENOENT: no such file or directory, open './ios/bundle/index.ios.jsbundle',ENOENT: no such file or directory, open './ios/bundle/index.ios.jsbundle'。
image
原因是根目录下没有build文件夹。新建bundle文件夹。
image
之后再次执行打包命令,打包的bundle和图片文件夹(此时空工程,没有图片)在ios/bundle路径下。react-native bundle --entry-file index.ios.js --bundle-output ./ios/bundle/index.ios.jsbundle --platform ios --assets-dest ./ios/bundle --dev false。
image

你可能感兴趣的:(React Native打离线包)