Skip to content

NX with React Native, trying to build the app to my device or trying to make a release build on xcode or on AndroidStudio #22665

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 of 4 tasks
miguelpenaranda2019122 opened this issue Apr 4, 2024 · 7 comments
Assignees
Labels
outdated scope: react-native Issues relating to React Native type: bug

Comments

@miguelpenaranda2019122
Copy link

Current Behavior

Hi, i has been trying to implement somes apps on RN with a nx monorepo, all was working good but realized that when i try to build the app on debug mode on simulator, its works fine but on my device i get the next error:

image

At the same time when i am trying to make a release version on xcode or android studios, i am getting the same error.

Some extra info: I i realized too that if i try to start metro from the app and not with the nx application_name start, its works but when the application is opened, i get the same error again.

can i get some help, please?

Expected Behavior

I am hoping to make the release version with android studios and xcode.

GitHub Repo

No response

Steps to Reproduce

Nx Report

the are not nx reports

Failure Logs

Node found at: /opt/homebrew/Cellar/node/21.6.1/bin/node

+ DEST=/Users/miguelcorreia/Library/Developer/Xcode/DerivedData/KeveMobile-eotzilmmbmnldidyrcecahpkovcf/Build/Products/Debug-iphoneos/KeveMobile.app

+ [[ ! -n '' ]]
+ [[ Debug = *Debug* ]]

+ [[ ! iphoneos == *simulator ]]

+ for num in 0 1 2 3 4 5 6 7 8

++ ipconfig getifaddr en0

+ IP=10.20.0.68

+ '[' '!' -z 10.20.0.68 ']'

+ break

+ '[' -z 10.20.0.68 ']'

+ echo 10.20.0.68

+ [[ -n '' ]]

+ case "$CONFIGURATION" in

+ [[ iphoneos == *simulator ]]

+ echo 'Bundling for physical device. Use the SKIP_BUNDLING flag to change this behavior.'

Bundling for physical device. Use the SKIP_BUNDLING flag to change this behavior.

+ DEV=true

+++ dirname ../../../node_modules/react-native/scripts/react-native-xcode.sh

++ cd ../../../node_modules/react-native/scripts/..

++ pwd

+ REACT_NATIVE_DIR=/Users/miguelcorreia/Documents/Nearsoft/@nearsoft-mobile-monorepo/node_modules/react-native

+ PROJECT_ROOT=/Users/miguelcorreia/Documents/Nearsoft/@nearsoft-mobile-monorepo/apps/keve-mobile/ios/..

+ cd /Users/miguelcorreia/Documents/Nearsoft/@nearsoft-mobile-monorepo/apps/keve-mobile/ios/..

+ [[ -n /Users/miguelcorreia/Documents/Nearsoft/@nearsoft-mobile-monorepo/apps/keve-mobile/ios/../src/main.tsx ]]

+ :

+ source /Users/miguelcorreia/Documents/Nearsoft/@nearsoft-mobile-monorepo/node_modules/react-native/scripts/node-binary.sh

++ '[' -z /opt/homebrew/Cellar/node/21.6.1/bin/node ']'

++ type /opt/homebrew/Cellar/node/21.6.1/bin/node

+ HERMES_ENGINE_PATH=/Users/miguelcorreia/Documents/Nearsoft/@nearsoft-mobile-monorepo/apps/keve-mobile/ios/Pods/hermes-engine

+ '[' -z '' ']'

+ HERMES_CLI_PATH=/Users/miguelcorreia/Documents/Nearsoft/@nearsoft-mobile-monorepo/apps/keve-mobile/ios/Pods/hermes-engine/destroot/bin/hermesc

+ [[ true != false ]]

+ [[ -f /Users/miguelcorreia/Documents/Nearsoft/@nearsoft-mobile-monorepo/apps/keve-mobile/ios/Pods/hermes-engine ]]

+ '[' -z '' ']'

+ export NODE_ARGS=

+ NODE_ARGS=

+ '[' -z '' ']'

+ export CLI_PATH=/Users/miguelcorreia/Documents/Nearsoft/@nearsoft-mobile-monorepo/node_modules/react-native/cli.js

+ CLI_PATH=/Users/miguelcorreia/Documents/Nearsoft/@nearsoft-mobile-monorepo/node_modules/react-native/cli.js

+ '[' -z '' ']'

+ BUNDLE_COMMAND=bundle

+ '[' -z '' ']'

+ COMPOSE_SOURCEMAP_PATH=/Users/miguelcorreia/Documents/Nearsoft/@nearsoft-mobile-monorepo/node_modules/react-native/scripts/compose-source-maps.js

+ [[ -z '' ]]

+ CONFIG_ARG=

+ BUNDLE_FILE=/Users/miguelcorreia/Library/Developer/Xcode/DerivedData/KeveMobile-eotzilmmbmnldidyrcecahpkovcf/Build/Products/Debug-iphoneos/main.jsbundle

+ EXTRA_ARGS=

+ case "$PLATFORM_NAME" in

+ BUNDLE_PLATFORM=ios

+ '[' '' = YES ']'

+ EMIT_SOURCEMAP=

+ [[ ! -z '' ]]

+ PACKAGER_SOURCEMAP_FILE=

+ [[ '' == true ]]

+ [[ true != false ]]

+ [[ true == false ]]

+ /opt/homebrew/Cellar/node/21.6.1/bin/node /Users/miguelcorreia/Documents/Nearsoft/@nearsoft-mobile-monorepo/node_modules/react-native/cli.js bundle --entry-file /Users/miguelcorreia/Documents/Nearsoft/@nearsoft-mobile-monorepo/apps/keve-mobile/ios/../src/main.tsx --platform ios --dev true --reset-cache --bundle-output /Users/miguelcorreia/Library/Developer/Xcode/DerivedData/KeveMobile-eotzilmmbmnldidyrcecahpkovcf/Build/Products/Debug-iphoneos/main.jsbundle --assets-dest /Users/miguelcorreia/Library/Developer/Xcode/DerivedData/KeveMobile-eotzilmmbmnldidyrcecahpkovcf/Build/Products/Debug-iphoneos/KeveMobile.app

(node:30679) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.

(Use `node --trace-deprecation ...` to show where the warning was created)

                Welcome to Metro v0.80.8

              Fast - Scalable - Integrated





error src/main.tsx: Cannot read properties of undefined (reading 'includes').

TypeError: Cannot read properties of undefined (reading 'includes')

    at module.exports (/Users/miguelcorreia/Documents/Nearsoft/@nearsoft-mobile-monorepo/apps/keve-mobile/.babelrc.js:6:39)

    at parseSync (/Users/miguelcorreia/Documents/Nearsoft/@nearsoft-mobile-monorepo/node_modules/@babel/core/lib/parse.js:40:72)

    at Object.transform (/Users/miguelcorreia/Documents/Nearsoft/@nearsoft-mobile-monorepo/node_modules/@react-native/metro-babel-transformer/src/index.js:209:11)

    at module.exports.transform (/Users/miguelcorreia/Documents/Nearsoft/@nearsoft-mobile-monorepo/node_modules/react-native-svg-transformer/index.js:51:30)

    at transformJSWithBabel (/Users/miguelcorreia/Documents/Nearsoft/@nearsoft-mobile-monorepo/node_modules/metro-transform-worker/src/index.js:286:45)

    at Object.transform (/Users/miguelcorreia/Documents/Nearsoft/@nearsoft-mobile-monorepo/node_modules/metro-transform-worker/src/index.js:411:18)

    at transformFile (/Users/miguelcorreia/Documents/Nearsoft/@nearsoft-mobile-monorepo/node_modules/metro/src/DeltaBundler/Worker.flow.js:54:36)

    at Object.transform (/Users/miguelcorreia/Documents/Nearsoft/@nearsoft-mobile-monorepo/node_modules/metro/src/DeltaBundler/Worker.flow.js:30:10)

    at execFunction (/Users/miguelcorreia/Documents/Nearsoft/@nearsoft-mobile-monorepo/node_modules/jest-worker/build/workers/processChild.js:149:17)

    at execHelper (/Users/miguelcorreia/Documents/Nearsoft/@nearsoft-mobile-monorepo/node_modules/jest-worker/build/workers/processChild.js:137:5)

    at execMethod (/Users/miguelcorreia/Documents/Nearsoft/@nearsoft-mobile-monorepo/node_modules/jest-worker/build/workers/processChild.js:140:5)

    at process.messageListener (/Users/miguelcorreia/Documents/Nearsoft/@nearsoft-mobile-monorepo/node_modules/jest-worker/build/workers/processChild.js:44:7)

    at process.emit (node:events:519:28)

    at emit (node:internal/child_process:951:14)

info Run CLI with --verbose flag for more details.

the transform cache was reset.

Command PhaseScriptExecution failed with a nonzero exit code

Package Manager Version

yarn 1.22.19

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

No response

@kensaadi
Copy link

kensaadi commented Apr 8, 2024

I have a same problem

@hx2ryu
Copy link

hx2ryu commented Apr 10, 2024

I have same issue. 😢

@kensaadi
Copy link

I found a solution with:

  • nx run app:bundle-ios
  • Open xcode and adding on the Build Phases tabs -> Copy Bundle Resources. Adding the main.bundle here.
  • comment all line on Bundle React Native code and Images. (do not delete it) just comment all line.
  • Run on your device. Good. Remember to change the run on release mode.

@kensaadi
Copy link

Ok, I found the solution.

  • Comment the condition if build on .babelrc.js
  • After that when compile with xcode don't update the warning information. All running whell.

@miguelpenaranda2019122
Copy link
Author

Ok, I found the solution.

  • Comment the condition if build on .babelrc.js
  • After that when compile with xcode don't update the warning information. All running whell.

@kensaadi this works, thank you so much!!!

@vaccarov
Copy link

@kensaadi Alpha male right there, thanks.
Bug was generated by NX_TASK_TARGET_TARGET being undefined somehow.

Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated scope: react-native Issues relating to React Native type: bug
Projects
None yet
Development

No branches or pull requests

6 participants