question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

react-native plugin run-android fail with default install (metro/babel)

See original GitHub issue

When using the instructions with android the app is installed on the device but metro ultimately fails at some point with the default App.tsx that comes with the plugin.

Current Behavior

Metro fails to bundle the js/ts with the default nrwl react-native app

Expected Behavior

App should load as expected

Steps to Reproduce

npx create-nx-workspace happynrwl \
--preset=react-native \
--appName=mobile

nx run-android mobile

Failure Logs

Duplicate __self prop found. You are most likely using the deprecated transform-react-jsx-self Babel plugin. Both __source and __self are automatically set when using the automatic runtime. Please remove transform-react-jsx-source and transform-react-jsx-self from your Babel config.

(Neither of the above plugins seem to be in use)

Environment

  • node 16
  • npm 8
  • MacOS M1
  • Android Nexus 10

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:3
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
curthipstercommented, Sep 19, 2022

Even better, @xiongemi’s fix in 14.7.6 seems to work without my patch above. Thank you @xiongemi.

1reaction
mtzfactorycommented, Sep 19, 2022

I’ve got the app running with hot reload and nx test working with the following change.

Add the plugins section to apps/<your name>/babel.config.json:

{
  "presets": ["module:metro-react-native-babel-preset"],
  "plugins": ["@babel/plugin-transform-react-jsx"]
}

I can confirm too that @curthipster solution works. Test working properly as well.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: Couldn't find preset "module:metro-react-native-babel ...
When trying to run "react-native-git-upgrade" it gives the following error: git-upgrade ERR! An error occurred during upgrade: Error: Couldn't ...
Read more >
BUILD FAILED: can't install the app when i run npm run android
Go to your babel.config and adding "plugins: ['react-native-reanimated/plugin']". Your babel.config.js file should look like this
Read more >
Announcing React Native 0.70
We are excited to release a new version of React Native, 0.70.0. This version comes with several improvements like a new unified ...
Read more >
Getting Started with FullStory React Native Capture
First, make sure your Android and iOS projects are properly configured with FullStory for Mobile Apps. This step can be skipped in an...
Read more >
Getting Started · React Native Paper
Getting Started. Installation. Open a Terminal in your project's folder and run: yarn add react-native-paper. or npm install react-native-paper.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found