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

@miguelpenaranda2019122

Description

@miguelpenaranda2019122

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

Activity

kensaadi

kensaadi commented on Apr 8, 2024

@kensaadi

I have a same problem

hx2ryu

hx2ryu commented on Apr 10, 2024

@hx2ryu

I have same issue. 😢

kensaadi

kensaadi commented on Apr 10, 2024

@kensaadi

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

kensaadi commented on Apr 11, 2024

@kensaadi

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

miguelpenaranda2019122 commented on Apr 12, 2024

@miguelpenaranda2019122
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

vaccarov commented on Apr 16, 2024

@vaccarov

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

github-actions

github-actions commented on May 17, 2024

@github-actions

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.

locked as resolved and limited conversation to collaborators on May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @FrozenPandaz@vaccarov@xiongemi@kensaadi@hx2ryu

      Issue actions

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