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.

JS Bundle Error after upgrading to 0.70.1.

See original GitHub issue

New Version

0.70.1

Old Version

0.69.5

Build Target(s)

android debug and maybe release too

Output of react-native info

info Fetching system and libraries information...
System:
    OS: Linux 5.19 Ubuntu 22.04.1 LTS 22.04.1 LTS (Jammy Jellyfish)
    CPU: (4) x64 Intel(R) Core(TM) i7-2640M CPU @ 2.80GHz
    Memory: 1.05 GB / 3.72 GB
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 18.9.0 - /snap/bin/node
    Yarn: 1.22.19 - /snap/bin/yarn
    npm: 8.19.1 - /snap/bin/npm
    Watchman: Not Found
  SDKs:
    Android SDK:
      API Levels: 29, 30, 31, 32, 33
      Build Tools: 29.0.2, 30.0.3, 31.0.0, 32.0.0, 33.0.0
      Android NDK: Not Found
  IDEs:
    Android Studio: AI-212.5712.43.2112.8815526
  Languages:
    Java: 1.8.0_342 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.2.0 => 18.2.0 
    react-native: 0.70.1 => 0.70.1 
  npmGlobalPackages:
    *react-native*: Not Found

Issue and Reproduction Steps

My issue is no library has been detected after the upgrade, for example:

error: Error: Unable to resolve module react-native-onesignal from /home/section/Documents/GitHub/MoonMeet-CrossPlatform/index.js: react-native-onesignal could not be found within the project or in these directories:
  node_modules
  ../../../node_modules
   7 |  */
   8 | import {AppRegistry} from 'react-native';
>  9 | import OneSignal from 'react-native-onesignal';                                                                                                        
     |                        ^
  10 | import App from './App';
  11 | import {name as MoonMeet} from './app.json';
  12 | import {ONESIGNAL_APP_ID} from './src/secrets/sensitive';
    at ModuleResolver.resolveDependency (/home/section/Documents/GitHub/MoonMeet-CrossPlatform/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:178:15)
    at DependencyGraph.resolveDependency (/home/section/Documents/GitHub/MoonMeet-CrossPlatform/node_modules/metro/src/node-haste/DependencyGraph.js:264:43)
    at Object.resolve (/home/section/Documents/GitHub/MoonMeet-CrossPlatform/node_modules/metro/src/lib/transformHelpers.js:170:21)
    at resolveDependencies (/home/section/Documents/GitHub/MoonMeet-CrossPlatform/node_modules/metro/src/DeltaBundler/graphOperations.js:466:33)
    at processModule (/home/section/Documents/GitHub/MoonMeet-CrossPlatform/node_modules/metro/src/DeltaBundler/graphOperations.js:232:31)
    at async traverseDependenciesForSingleFile (/home/section/Documents/GitHub/MoonMeet-CrossPlatform/node_modules/metro/src/DeltaBundler/graphOperations.js:221:3)
    at async Promise.all (index 0)
    at async initialTraverseDependencies (/home/section/Documents/GitHub/MoonMeet-CrossPlatform/node_modules/metro/src/DeltaBundler/graphOperations.js:204:3)
    at async DeltaCalculator._getChangedDependencies (/home/section/Documents/GitHub/MoonMeet-CrossPlatform/node_modules/metro/src/DeltaBundler/DeltaCalculator.js:208:25)
    at async DeltaCalculator.getDelta (/home/section/Documents/GitHub/MoonMeet-CrossPlatform/node_modules/metro/src/DeltaBundler/DeltaCalculator.js:90:16)

if I comment (//) OneSignal and Notifee codes, I got ./app.json is not found 😕 which is 100000% inside my root project folder. I’m pretty sure it’s a wrong node modules folder or something, when i rollback to 0.69.5 my application works fine

steps:

  1. followed react-native community upgrade helper instruction strictly two times.
  2. did yarn start --reset-cache
  3. did cd android && ./gradlew clean && cd ..
  4. did yarn android
  5. building looks fine without any errors
  6. after Gradle task installDebug
  7. got those errors above

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:2
  • Comments:16 (2 by maintainers)

github_iconTop GitHub Comments

9reactions
AliMamedcommented, Sep 27, 2022

For me the problem was in metro.config.js. Снимок экрана 2022-09-27 в 13 45 01 Lines 9-11 caused the problem.

  resolver: {
    sourceExts: ['jsx', 'js', 'ts', 'tsx'],
  },

Adding json extension to the array solved the problem. I must admit that the error reporting for me was also confusing: I had the errors of resolving other modules rather than anything wrong with app.json.

@SectionTN I see similar config in your repo, so I think you can try fixing your project by adding json to the array.

1reaction
AliMamedcommented, Sep 27, 2022

already have this config inside my metro config

so add json extension there

Read more comments on GitHub >

github_iconTop Results From Across the Web

I have some problem when I upgrade my react-native version ...
I was clean my cache but It dont work!!! ERROR TypeError: undefined is not a function, js engine: hermes ERROR Invariant Violation: Failed...
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 >
Troubleshooting for React Native | Sentry Documentation
If you experience mismatched line numbers on sentry.io when using RAM Bundles, this is due to a bug on the Metro tooling. React...
Read more >
main.jsbundle does not exist [fixed] | by Onexlab - Medium
No bundle URL present. Make sure you're running a packager server or have include a .jsbundle file in your application bundle. If you...
Read more >
invariant violation viewproptypes has been removed - You.com
A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle...
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