react-native-webview icon indicating copy to clipboard operation
react-native-webview copied to clipboard

Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'RNCWebViewModule' could not be found

Open devi-prsd opened this issue 1 year ago • 42 comments

Bug description:

Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'RNCWebViewModule' could not be found. Verify that a module by this name is registered in the native binary.Bridgeless mode: false. TurboModule interop: false. 
Modules loaded: {
   "NativeModules":
      ["PlatformConstants","LogBox","SourceCode","Timing","AppState","BlobModule","WebSocketModule","SettingsManager","DevSettings","Networking","RedBox","Appearance","DevLoadingView","DeviceInfo","UIManager","RNCSafeAreaContext","NativeAnimatedModule","I18nManager","StatusBarManager","StatusBarManager","ImageLoader","KeyboardObserver","AccessibilityManager","RNGestureHandlerModule","AsyncLocalStorage"],
   "TurboModules":[],
   "NotFound":["NativePerformanceCxx","NativePerformanceObserverCxx","BugReporting","HeadlessJsTaskSupport","SoundManager","FrameRateLogger","AccessibilityInfo","PlatformLocalStorage","RNC_AsyncSQLiteDBStorage","RNCAsyncStorage","AsyncSQLiteDBStorage","RNCWebViewModule"]
}, 
js engine: hermes
ERROR  Invariant Violation: "main" has not been registered. This can happen if:
example:example:ios: * Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
example:example:ios: * A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called., js engine: hermes

Environment:

  • OS: MacOS
  • OS version: Sonoma 14.5
  • react-native version: 0.73.2
  • react-native-webview version: 13.10.5
  • expo: ~50.0.17

devi-prsd avatar Jul 23 '24 21:07 devi-prsd

+1

Neha1405 avatar Jul 24 '24 13:07 Neha1405

If you just updated the webview version, then do npx pod-install

badalsaibo avatar Jul 25 '24 07:07 badalsaibo

It also happens on Android.

 OS: macOS 14.5
 CPU: (8) arm64 Apple M2
 react-native: 0.73.7
 Android:
  hermesEnabled: true
  newArchEnabled: false
 react-native-webview: 13.10.5 

Downgrading to "react-native-webview": "^12" works for me.

JungHsuan avatar Jul 27 '24 06:07 JungHsuan

+1

+1

qaz3954179 avatar Jul 29 '24 06:07 qaz3954179

+1

pratiksham28 avatar Jul 29 '24 07:07 pratiksham28

+1

jaslloyd avatar Jul 29 '24 20:07 jaslloyd

This error means you are using the new architecture & the native implementation of the RNCWebViewModule Turbomodule was not found by JS.

If you are using version => v13.10.5, you'll need to re-build the native code (using cocoapods or gradle) to ensure the native module is present.

iOS

rm -rf ios/build
rm -rf ios/Pods
cd ios && pod install

Android

cd android
./gradlew clean

The example in https://github.com/react-native-webview/react-native-webview/blob/master/example/App.tsx is using the new Turbomodule when new architecture is enabled.

shwanton avatar Jul 29 '24 22:07 shwanton

Anyone know how to do this /\ in an expo project?

Krucial92 avatar Jul 30 '24 01:07 Krucial92

+1

Ceofy avatar Jul 30 '24 04:07 Ceofy

downgrade to "react-native-webview": "~13.6.3",

happybab2 avatar Jul 30 '24 10:07 happybab2

downgraded to "react-native-webview": "~13.6.4" and it is working fine

pratiksham28 avatar Jul 30 '24 10:07 pratiksham28

I am still running into this issue after trying everything above.

tommytsai1 avatar Jul 31 '24 01:07 tommytsai1

If you are working in EXPO, You gotta do these 2 things to make sure it's working fine on both OS

(1) Android requires certain permissions to access the internet and other resources. Make sure you have the appropriate permissions set in your app.json file under the android.permissions key. { "expo": { "android": { "permissions": ["INTERNET"] } } }

AND (2) Expo has a separate package for WebView support. Make sure you are using the correct WebView component from the Expo ecosystem:

expo install react-native-webview

This works for me very well.

ismailxkhalid avatar Jul 31 '24 08:07 ismailxkhalid

I degraded react-native-webview to 13.6.4

Thanks worked for me

ganeshmohane avatar Aug 02 '24 16:08 ganeshmohane

I am still running into this issue after trying everything above.

Try degrading webview package

ganeshmohane avatar Aug 02 '24 16:08 ganeshmohane

@ismailxkhalid Just a clarification, expo doesn't have a separate package if you look at deeply into the package its exactly the same. That expo command checks that the package that you give is valid with your current setup (aka your current SDK version etc etc) / installs the package version that is valid with your SDK version but its still this package / library.

jaslloyd avatar Aug 02 '24 16:08 jaslloyd

I am using Expo and doing everything I can but still getting the error message. Is there any way to fix this please? I am losing days over this. Thank you!!

718gts4 avatar Sep 04 '24 01:09 718gts4

Have u tried degrading the react-native-webview pacakage?

ganeshmohane avatar Sep 04 '24 04:09 ganeshmohane

I have but it doesn't seem to work

718gts4 avatar Sep 04 '24 05:09 718gts4

I don't remember exactly but I think it worked after a cache clean for me. react-native-webview version: 13.10.4 SDK version: 51.0.32

Ceofy avatar Sep 04 '24 14:09 Ceofy

"react-native": "0.74.5", "expo": "~51.0.28", "react-native-webview": "13.10.5"

I'm sorry, I tried version 13.10.5 and all later versions, but the issue exists in all of them.

Chris-Jie avatar Sep 14 '24 13:09 Chris-Jie

all the steps discussed above , doesn't work for me I was trying to migrate from bare react-native project to expo

image

got any other solution?

anasvemmully avatar Sep 19 '24 09:09 anasvemmully

@anasvemmully Either downgrade <= 13.10.4 or use npx expo run:ios to use development builds. Expo Go doesn't support react-native-webview > 13.10.4.

I'm hoping there's another solution :(

andflett avatar Sep 19 '24 15:09 andflett

I was experiencing this issue.

I ran the expo doctor: npx expo install --check

This identified that my version of react-native-webview was not the correct version for Expo image

After that, I rebuilt my development version of my app by executing: eas build --platform android --profile development

Then ran my project clearing the cache: npx expo start -c I am no longer having this issue.

JohnTechAU avatar Oct 09 '24 04:10 JohnTechAU

Amazing Expo! Wasting my time

JAEHOON-1993 avatar Oct 10 '24 13:10 JAEHOON-1993

all the steps discussed above , doesn't work for me I was trying to migrate from bare react-native project to expo

image

got any other solution?

Its version issues of packages, try fixing it use expo doctor

ganeshmohane avatar Oct 28 '24 16:10 ganeshmohane

I think if you guy use expo, you should use comman expo install and expo 's package like "expo-linear-gradient"

phucduongminh avatar Oct 29 '24 03:10 phucduongminh

Try rebuilding your expo app.

eas build --profile development --platform android

or use the local flag to build locally

eas build --profile development --platform android --local

replace android with ios if you're building for ios.

Also run expo-doctor to make sure everything is fine.

jgmagift avatar Nov 03 '24 18:11 jgmagift

expo install [email protected] expo start -c please add it on app.json file { "expo": { "jsEngine": "jsc" } }

I've been facing this issue for the past two days. Despite reading numerous articles and exploring various GitHub code examples, I wasn't able to achieve the expected results. However, after extensive effort, I was finally able to resolve and overcome the problem.

gaurdeveloper1916 avatar Nov 08 '24 07:11 gaurdeveloper1916

Quando for instalar o react-native-webview utilize o:

npx expo install react-native-webview

AndreFoggiatto avatar Nov 10 '24 22:11 AndreFoggiatto