JS Bundle Error after upgrading to 0.70.1.

This issue has been created since 2022-09-16.

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
SectionTN wrote this answer on 2022-09-16

any updates on this?
also why is the directory ../../../node_modules, i think it's wrong.

marceloch2 wrote this answer on 2022-09-18

I have the same for IOS.

SectionTN wrote this answer on 2022-09-18

i hope someone finds a solution.

SectionTN wrote this answer on 2022-09-20

@cortinico (sorry for the ping without your permission) could you check this issue please?

cortinico wrote this answer on 2022-09-20

@cortinico (sorry for the ping with your permission) could you check this issue please?

Can you provide a reproducer?

SectionTN wrote this answer on 2022-09-21

I did init a new React Native Project 0.70.1, nothing went wrong with the bundler, but it's not working with my project, could you try to run this, repo link, choose branch upgrade/RN70.1

cortinico wrote this answer on 2022-09-21

I did init a new React Native Project 0.70.1, nothing went wrong with the bundler, but it's not working with my project, could you try to run this, repo link, choose branch upgrade/RN70.1

I could not build your project @SectionTN. A simple yarn && yarn android fails with:

> Could not resolve all files for configuration ':react-native-clipboard_clipboard:classpath'.
   > Could not download builder-3.2.1.jar (com.android.tools.build:builder:3.2.1)
      > Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/builder/3.2.1/builder-3.2.1.jar'.

As you're depending on react-native-clipboard which is on AGP 3 (which is quite of an old version) and can't be resolved anymore. Your project is also full of dependencies making hard to pinpoint the problem. Can you create a smaller reproducer?

SectionTN wrote this answer on 2022-09-21

Yes my project depending on react-native-clipboard/clipboard package.

i can build my project on linux / windows without problems, idk why it's showing you a build error there.

i have did npx react-native init Project and tried building, nothing went wrong on a fresh project, as you said it's hard to find the problem here, I'll add any comment may help resolving this problem if possible.

PS: the build is passing on the Android CI workflow.

SectionTN wrote this answer on 2022-09-22

re-upgraded again and encountered the same issue Screenshot_20220921-175922_Moon Meet.png

AliMamed wrote this answer on 2022-09-27

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.

SectionTN wrote this answer on 2022-09-27

Screenshot_20220927-121223_GitHub.png
already have this config inside my metro config

AliMamed wrote this answer on 2022-09-27

already have this config inside my metro config

so add json extension there

SectionTN wrote this answer on 2022-09-28

thanks adding json fixed my problem

More Details About Repo
Owner Name facebook
Repo Name react-native
Full Name facebook/react-native
Language JavaScript
Created Date 2015-01-09
Updated Date 2022-10-07
Star Count 105180
Watcher Count 3671
Fork Count 22481
Issue Count 2230

YOU MAY BE INTERESTED

Issue Title Created Date Comment Count Updated Date
Color-goggles v1.0.1 not launching 18 2018-07-21 2022-10-06
Black and White screen when click "Test" 7 2018-07-27 2022-10-06
Fix icon background (white dots) 2 2020-06-02 2022-06-30
Compiler output is colored only for a single project 9 2020-03-26 2022-06-30
Cannot sense DFJK when playing games (most updated macOS version) 1 2022-06-18 2022-10-01
イイコ進化論(feat. O-LuHA) 全難易度の本家譜面提案された修正 1 2022-06-12 2022-10-03
I have a Issue with displaying a Gif or a Image. 3 2021-09-15 2022-08-30
thanks for your code! 2 2021-11-09 2022-10-06
unpassed verification against cublas sgemm 2 2021-11-19 2022-09-28
NPN&PNP behave funny 3 2022-02-27 2022-09-30
Static framework compiled for Swift 5.7 2 2022-06-23 2022-10-06
[Bug] Error in win criteria view (reputation) 6 2021-08-03 2022-08-13
bfgminer cli clears console 0 2021-11-02 2022-10-07
Automated Changelogs 3 2022-02-09 2022-09-18
Setting fiber_properties on fiber construction 3 2021-09-20 2022-09-17
[Bug] After 3.7.0 release WhatsApp and Discord data is deleted, although all options are enabled 32 2022-05-24 2022-09-24
Endpoint for custom purchase confirmation services results 0 2021-01-27 2022-08-13
add new market revisit 0 2022-02-17 2022-10-01
Remove "Please wait" if possible 3 2021-11-14 2022-09-29
How to track the performance of linear measurement? 1 2021-08-04 2022-09-25
swipe изображение на мобиле можно замутить? 1 2021-02-26 2022-09-01
tf2.3 cuda10.1 tf.load_op_libary("build/libadd2.so") error 2 2021-03-30 2022-09-27
Error in connecting to ws. 1 2021-04-04 2022-10-04
"Reinvest all" does not place the amount reinvested in the blockchain transaction details 0 2021-12-12 2022-10-06
Warble on Win10 stalls without any information 6 2022-06-15 2022-09-29
Replace query params to http context 0 2021-05-27 2022-09-13
Support multiple snode trees on opengl backend 2 2022-01-17 2022-10-04
Lab 07 Task 5 Missing instruction to update CupcakeController HttpPost Edit action - Solved 0 2021-10-27 2022-04-23
Change User Name Password 1 2022-07-14 2022-09-20
Widgets Reset on Page Title Change 2 2018-11-07 2022-10-07
Parallax background flashing white when scrolling 2 2016-07-19 2022-08-25
The menu icon in shapely does not work on mobile 1 2018-11-14 2022-09-18
Dead-code elimination of unused default parameters 2 2022-04-15 2022-09-17
Infer `lang` from `src` attribute 1 2022-08-25 2022-09-27
LF_POINTER with ptr32 kind has size 8 bytes 4 2022-06-07 2022-10-06
Can't find systemd or crontab entry 4 2021-01-13 2022-09-26
Custom markers don't show custom color in 'short test summary info' section 15 2022-05-15 2022-09-26
Commit local blacklist file without Internet access? 1 2021-04-23 2022-09-27
etcd leader change causes reconciliation of all deployments 0 2022-01-04 2022-09-27
Retrieve Traces using gRpc 2 2021-03-23 2022-09-27
Bug/Feature Request: Search data other than "textField" using AJAX 3 2021-03-29 2022-10-06
No update PR created for private github action shared with enterprise/org 1 2022-02-28 2022-09-24
[Pytorch 1.10.1] fail to install using pip and python 3.10.1 2 2022-01-21 2022-10-06
star (*) symbol in text box cuts off bottom of text when saved 18 2019-09-20 2022-09-21
[Feature Request] TUN interface support (Simple VPN solution) 9 2015-08-18 2022-10-03
Small problems with terminal icons showing up 3 2022-01-02 2022-10-06
about single parameter listener error, (.apply is not a function error) 2 2022-05-09 2022-10-04
HELP: Not able to send message from my vue component to my content script on Firefox 2 2021-07-13 2022-10-05
Can not generate token on k8s v1.24.0 2 2022-05-13 2022-10-07
issue with flet -> cl-flet change 1 2014-02-05 2022-09-18