I'm trying to archive my (otherwise perfectly building, running on simulator/device for debug) iOS app built with React Native.
When I try to archive in Xcode, it compiles and links correctly but while trying to generate assets the following command is invoked:
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
It fails with error:
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.
(Before you ask, yes, react-native
is installed in my project dependencies, obviously)
When I invoke that exact node command manually, it generates assets perfectly fine:
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
I am unable to archive my app because of this. It suggests me to run CLI with --verbose
flag but I have no idea where to add the flag as the command itself is invoked from an autogenerated/complicated script.
What am I doing wrong? I am on Xcode 10.2 and React Native 0.59.3.
After investigating some issues such as https://github.com/facebook/react-native/issues/22354 I've found the problem after several hours:
I had a space in my project path. I've moved my project to a path without space and it started to archive perfectly. Apparently, it really was a bug with React Native.