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

'RNCWebView' could not be found

Open Shoaib-Akh opened this issue 2 years ago • 69 comments

Bug description:

To Reproduce:

ERROR Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'RNCWebView' could not be found. Verify that a module by this name is registered in the native binary. ERROR Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native. ERROR Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native. Expected behavior:

Screenshots/Videos:

Environment:

  • OS:
  • OS version:
  • react-native version:"0.64.4"
  • react-native-webview version:12.0.2"

Shoaib-Akh avatar May 12 '23 11:05 Shoaib-Akh

Same issue

hemantdelta avatar May 12 '23 13:05 hemantdelta

Same issue

weasteam avatar May 13 '23 05:05 weasteam

I found the solution:

cd ios
/opt/homebrew/Cellar/cocoapods/1.12.1/bin/pod install

# you can also use pod install if pod is available for you.

If you could not find pod, you need to find the pod via whereis pod, in my cases it is said /opt/homebrew/bin/pod, but it is actually point to /opt/homebrew/Cellar/cocoapods/1.12.1/bin/pod.

I tried to add it to my $PATH, it is not working.

weasteam avatar May 13 '23 06:05 weasteam

same issue with android ios work well

khanhtn91 avatar May 15 '23 07:05 khanhtn91

Does anybody have a solution to this, experiencing the same issue on android?

maryamkhidir avatar May 15 '23 19:05 maryamkhidir

I have resolved it downgrade to v11.23.1

khanhtn91 avatar May 16 '23 15:05 khanhtn91

Same issue with android.

Hadi-G avatar May 16 '23 16:05 Hadi-G

I have resolved it downgrade to v11.23.1

Worked for me ! Thanks @khanhtn91

Hadi-G avatar May 16 '23 17:05 Hadi-G

If you are like me, and running your build from CLI instead of XCode directly, you can solve this by running the build once from XCode which seems to be needed to automatically link up the new Pods after updating to this newer version. Hope that helps someone.

gilluminate avatar May 18 '23 21:05 gilluminate

Hi team, same issue with us.

we can not downgrade the react-native-webView version to. 11.23.1 . any other solution to resolve it?

OS: MacOS OS version: Android 12 and Android 13 react-native version:"0.64.4" react-native-webview version:12.0.2"

Bug description:

To Reproduce:

ERROR Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'RNCWebView' could not be found. Verify that a module by this name is registered in the native binary. ERROR Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native. ERROR Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.

vijaydevlandg avatar May 23 '23 06:05 vijaydevlandg

Downgrading to 12.1.0 works for me.

tanbt avatar Jun 04 '23 14:06 tanbt

chez moi ce qu'a généré l'erreur c'est que certaines dépendances sont incompatibles avec la version d'expo installée : j'avais installé [email protected] Mais quand j'ai installé [email protected] mon code a fonctionné

bamba0799 avatar Jun 07 '23 13:06 bamba0799

Worked perfectly ! Thanks @gilluminate

If you are like me, and running your build from CLI instead of XCode directly, you can solve this by running the build once from XCode which seems to be needed to automatically link up the new Pods after updating to this newer version. Hope that helps someone.

Ptdavid0 avatar Jun 09 '23 17:06 Ptdavid0

In my case, I was on react-native: 0.66.1, and I guess the latest version of react-native-web-view is not compatible with old react-native version.

Downgrading to 11 version worked as @khanhtn91 mentioned. yarn add react-native-webview@11

See also: https://github.com/react-native-webview/react-native-webview/pull/2686#issuecomment-1414603408

vzts avatar Jun 11 '23 16:06 vzts

You need to mock the module

jest.mock('react-native-webview', () => ({
  default: () => jest.fn() // or any mocked component instead of native view,
}))

https://github.com/react-native-webview/react-native-webview/pull/2686#issuecomment-1425865443

ezesimeoni avatar Jun 13 '23 18:06 ezesimeoni

Same issue,

"react-native": 0.71.12,
"react-native-webview": 13.2.2,
"jest": "29.5.0"

What is the suggested Mock to interact with the component? I tried a simple Mock passing these props

{
      goBack: jest.fn(),
      goForward: jest.fn(),
      reload: jest.fn(),
      stopLoading: jest.fn(),
      injectJavaScript: jest.fn(),
      requestFocus: jest.fn(),
      postMessage: jest.fn(),
      clearFormData: jest.fn(),
      clearCache: jest.fn(),
      clearHistory: jest.fn(),
    }

My Error just changed to Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.

eppisapiafsl avatar Jul 05 '23 23:07 eppisapiafsl

I have the same issue. react-native: 0.70.4 react-native-webview: 12.1.0

thep-dr avatar Jul 17 '23 06:07 thep-dr

same issue "react-native": "0.71.8" "react-native-webview": "^13.2.2", "expo": "~48.0.18"

Revolt9k avatar Jul 18 '23 06:07 Revolt9k

same issue in android , downgrade to 11.23.1 isn't working.

Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'RNCWebView' could not be found. Verify that a module by this name is registered in the native binary. reportException @ ExceptionsManager.js:76 handleException @ ExceptionsManager.js:160 handleError @ setUpErrorHandling.js:24 reportFatalError @ error-guard.js:49 guardedLoadModule @ require.js:204 metroRequire @ require.js:128 (anonymous) @ appReducer.js:46 executeApplicationScript @ debuggerWorker.aca173c4.js:4 (anonymous) @ debuggerWorker.aca173c4.js:4

"react": "16.11.0", "react-native": "0.62.2", "react-native-webview": "12.1.0"

Umar24 avatar Jul 20 '23 11:07 Umar24

Same issue here: image

capraynor avatar Jul 22 '23 16:07 capraynor

Same issue here when running my tests:

"react": "18.2.0",
"react-native": "0.71.11",
"jest": "^29.2.1",
"react-native-webview": "^13.2.2",

Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'RNCWebView' could not be found. Verify that a module by this name is registered in the native binary.

SofianeToumert avatar Jul 24 '23 16:07 SofianeToumert

expo prebuild did nothing but npx react-native run-ios solved issue on ios npx react-native run-android solved issue on android

Revolt9k avatar Jul 27 '23 10:07 Revolt9k

expo prebuild did nothing but npx react-native run-ios solved issue on ios npx react-native run-android solved issue on android

worked for me as well - thanks!

forbesd7 avatar Jul 28 '23 06:07 forbesd7

Same issue here

qalqi avatar Jul 28 '23 19:07 qalqi

Manually linking react-native-webview fixed the issue in android

 android/app/build.gradle
 android/app/src/main/java/earth/wallet/app/MainApplication.java
 android/settings.gradle

qalqi avatar Jul 28 '23 19:07 qalqi

I have resolved it downgrade to v11.23.1

work for me, thanks

SandiChai avatar Aug 08 '23 15:08 SandiChai

Is there anyone to solve this issue? I have met this bug when my android targer is 33

tigerjiang avatar Aug 22 '23 09:08 tigerjiang

Same issue. Tried all

olegkhorev avatar Aug 22 '23 20:08 olegkhorev

I have resolved it downgrade to v11.23.1

Worked for me. This is what I did: npx expo install react-native-webview@11.

JCcastagne avatar Aug 23 '23 00:08 JCcastagne

When I try older version - it does not run at all. Like deprecated version - new version is community version, old one is. deprecated.

olegkhorev avatar Aug 23 '23 10:08 olegkhorev