cli
cli copied to clipboard
Custom cli path on ios?
Ask your Question
I have a monorepo using yarn 3 and workspaces with the below structure:
applications
- mobile
package.json
- web
package.json
package.json
Currently all my dependencies are going to the top level on the same level as applications.
In the android build.gradle I added
project.ext.react = [
cliPath: "../../../../node_modules/react-native/local-cli/cli.js",
]
This works great for Android and I am able to build my app both locally and in AppCenter.
In iOS though I add in the following in Build Phases in Xcode under Bundle React Native code and images:
export NODE_BINARY=node
export PROJECT_ROOT="$PROJECT_DIR/.."
../../../node_modules/react-native/scripts/react-native-xcode.sh
this seems to work locally. I can build the app and run it in the Simulator but when I run it in AppCenter I get the following error:
[command]/bin/bash --noprofile --norc /Users/runner/work/_temp/673ca5d8-cfaf-4f0c-bc1a-ca73ee655a4a.sh
Found index.js for ReactNative index.
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module '/Users/runner/work/1/s/dashboard/applications/mobile/node_modules/react-native/local-cli/cli.js'
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
So my question is if I am missing something for iOS because it seems that it cannot find the local cli for some reason. Thank you very much in advance.