Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'RNCClipboard' could not be found. #246

Open
suhmah opened this issue May 28, 2024 · 17 comments
Labels
bug Something isn't working

Comments

@suhmah
Copy link

suhmah commented May 28, 2024

Environment

Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'RNCClipboard' 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","Timing","AppState","SourceCode","BlobModule","WebSocketModule","SettingsManager","DevSettings","RedBox","Networking","Appearance","DevLoadingView","UIManager","DeviceInfo","ImageLoader","LinkingManager"],"TurboModules":[],"NotFound":["NativePerformanceCxx","NativePerformanceObserverCxx","BugReporting","HeadlessJsTaskSupport","SoundManager","IntentAndroid","RNCClipboard"]}, js engine: hermes

Platforms

iOS only

Versions

  • iOS: 17.2
  • react-native: "0.74.1"
  • react: "18.2.0"
    "@react-native-clipboard/clipboard": "^1.14.1",

Description

I have the following error
Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'RNCClipboard' 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","Timing","AppState","SourceCode","BlobModule","WebSocketModule","SettingsManager","DevSettings","RedBox","Networking","Appearance","DevLoadingView","UIManager","DeviceInfo","ImageLoader","LinkingManager"],"TurboModules":[],"NotFound":["NativePerformanceCxx","NativePerformanceObserverCxx","BugReporting","HeadlessJsTaskSupport","SoundManager","IntentAndroid","RNCClipboard"]}, js engine: hermes

image
image

Reproducible Demo

the error happens when running yarn ios and the application is installed. before even starting the metro bundle it gives an error

@suhmah suhmah added the bug Something isn't working label May 28, 2024
@nvacheishvili
Copy link

Having the same issue

@BrianIto
Copy link

BrianIto commented Jun 3, 2024

Same here. Did the pod install in the ios directory. Still getting the issue.

@poojagirne
Copy link

poojagirne commented Jun 4, 2024

Same issue in andriod also while testing in real device.

@BrianIto
Copy link

BrianIto commented Jun 4, 2024

@suhmah I really don't get why this is happening, but using expo modules with expo dev client and expo-clipboard package solved the whole problem to me.

I want to just add the the newer version of Expo requires minimum development target to be 13.4 on iOS environments.

@poojagirne
Copy link

poojagirne commented Jun 4, 2024

@suhmah I really don't get why this is happening, but using expo modules with expo dev client and expo-clipboard package solved the whole problem to me.

I want to just add the the newer version of Expo requires minimum development target to be 13.4 on iOS environments.

Even after using Expo, I am still getting the same error while testing on an actual device, not in the simulator.

@Nelie-Taylor
Copy link

I got same issue.

@ijs1103
Copy link

ijs1103 commented Jun 11, 2024

Both Android emulators and devices have the same problem.

@truezombie
Copy link

I have the same error.

@BrianIto
Copy link

I got the error again, and then migrated to expo-clipboard. Sorry, folks, that's not much help but it is what worked for me. :(

@UgurGumushan
Copy link

I experienced it on mocha tests after version upgrade and I mocked the module. Does it affect production code?

@williamAstudillo
Copy link

williamAstudillo commented Aug 13, 2024

Rebuilding the app fixed it for me

@MarcosCunhaDev
Copy link

So, I had the same problem recently while running my tests after upgrading RN to version 0.74.2. After some research, I found a recommendation for how to mock @react-native-clipboard/clipboard. Here’s what I did:

  • I imported mockClipboard at the top of the setupJest file:
    import mockClipboard from '@react-native-clipboard/clipboard/jest/clipboard-mock.js';
  • I Added the following block of code between my mocks:
    jest.mock('@react-native-clipboard/clipboard', () => mockClipboard);

After this, the issue was resolved.

@nishith003
Copy link

In my case, I encountered the same issue and was able to resolve it with the following steps:

I changed the import from:

import Clipboard from '@react-native-clipboard/clipboard';

to:

import * as Clipboard from '@react-native-clipboard/clipboard';

For copying a string to the clipboard:

Clipboard.default.setString(address);

It worked for me on Android devices. I hope this helps anyone facing the same issue!

@JohnSmall
Copy link

@nishith003 I tried your fix, but it didn't work for me.

@dibasdauliya
Copy link

same issue

@xiangjiu0918
Copy link

xiangjiu0918 commented Nov 30, 2024

So, I had the same problem recently while running my tests after upgrading RN to version 0.74.2. After some research, I found a recommendation for how to mock @react-native-clipboard/clipboard. Here’s what I did:

  • I imported mockClipboard at the top of the setupJest file:
    import mockClipboard from '@react-native-clipboard/clipboard/jest/clipboard-mock.js';
  • I Added the following block of code between my mocks:
    jest.mock('@react-native-clipboard/clipboard', () => mockClipboard);

After this, the issue was resolved.

Here's another way to mock @react-native-clipboard/clipboard, I solved the issue in this way.

  1. In your project root directory, create __mocks__/@react-native-clipboard directory.
  2. Inside that folder, create clipboard.js file.
  3. Inside that file, export clipboard mock.
    export * from '@react-native-clipboard/clipboard/jest/clipboard-mock.js';

@GustBM
Copy link

GustBM commented Dec 6, 2024

Im having the same issue, did anybody found a fix yet?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests