我正在尝试将我的(否则是完美的构建,在模拟器/设备上运行以进行调试)使用React Native构建的iOS应用存档。
当我尝试在Xcode中存档时,它可以正确编译和链接,但是在尝试生成资产时会调用以下命令:
node '/Users/Can/Documents/Programming/React Native/REDACTED/node_modules/react-native/cli.js' bundle --entry-file index.js --platform ios --dev false --reset-cache --bundle-output /Users/Can/Library/Developer/Xcode/DerivedData/REDACTED-eebdhuhscigvmvduljehleepetoi/Build/Intermediates.noindex/ArchiveIntermediates/REDACTED/BuildProductsPath/Release-iphoneos/REDACTED.app/main.jsbundle --assets-dest /Users/Can/Library/Developer/Xcode/DerivedData/REDACTED-eebdhuhscigvmvduljehleepetoi/Build/Intermediates.noindex/ArchiveIntermediates/REDACTED/BuildProductsPath/Release-iphoneos/REDACTED.app
它失败并显示错误:
error Unable to find React Native files. Make sure "react-native" module is installed in your project dependencies.. Run CLI with --verbose flag for more details.
(显然,在您询问之前,是,react-native
已安装在我的项目依赖项中)
当我手动调用该确切的节点命令时,它会很好地生成资产:
warning: the transform cache was reset.
Loading dependency graph, done.
info Writing bundle output to:, /Users/Can/Library/Developer/Xcode/DerivedData/REDACTED-eebdhuhscigvmvduljehleepetoi/Build/Intermediates.noindex/ArchiveIntermediates/REDACTED/BuildProductsPath/Release-iphoneos/REDACTED.app/main.jsbundle
info Done writing bundle output
info Copying 30 asset files
info Done copying assets
因此,我无法存档我的应用程序。它建议我使用--verbose
标志运行CLI,但是我不知道在哪里添加标志,因为命令本身是从自动生成的/复杂的脚本中调用的。
我在做什么错?我正在使用Xcode 10.2和React Native 0.59.3。
答案 0 :(得分:0)
根据错误确保已安装“ react-native”模块,您不在项目的根路径上。因此,删除导出的数据并在OPen Terminal中设置工程路径
cd ../projectpath_foldername
运行命令
npm start
之后
react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ios/main.jsbundle --assets-dest ios
现在运行
react-native run-ios
一旦构建并运行,请打开xcode并存档您的应用。
答案 1 :(得分:0)
在调查了诸如https://github.com/facebook/react-native/issues/22354之类的一些问题之后,几个小时后我发现了问题:
我的项目路径中有一个空格。我已将项目移至没有空间的路径,并且开始完美存档。显然,这确实是React Native的一个错误。