mrousavy / react-native-vision-camera

πŸ“Έ A powerful, high-performance React Native Camera library.
https://react-native-vision-camera.com
MIT License
6.64k stars 983 forks source link

[V4] [iOS] Error: react-native-worklets-core is not installed! πŸ› #2827

Closed Tymofiev closed 2 weeks ago

Tymofiev commented 2 weeks ago

What's happening?

When app starts on iOS without react-native-worklets-core installed Error: react-native-worklets-core is not installed!, js engine: hermes error is thrown. Following https://www.react-native-vision-camera.com/docs/guides/frame-processors#disabling-frame-processors guide to explicitly disable frame processors makes no change.

React Native version: 0.71.15.

PS: This works fine on example app after uninstalling react-native-worklets-core dependency and removing useFrameProcessor from camera page.

Reproduceable Code

  return (
    <VisionCamera
      ref={camera}
      style={style}
      device={device}
      isActive={isActive}
      audio={false}
      zoom={device?.neutralZoom}
      onLayout={({ nativeEvent: { layout: { height, width } } }) => setContainerRatio(height / width)}
      onInitialized={() => setReady(true)}
      photo
    />
  )

Relevant log output

BUNDLE  ./index.js 
ERROR  Error: react-native-worklets-core is not installed!, js engine: hermes
LOG  Running "AppName" with {"rootTag":61,"initialProps":{}}
ERROR  Invariant Violation: "AppName" has not been registered. This can happen if:
* 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.
* A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called., js engine: hermes

Camera Device

N/A

Device

iPhone 15 (iOS 17.4) Simulator iPhone 11 (iOS 17.4.1)

VisionCamera Version

4.0.1

Can you reproduce this issue in the VisionCamera Example app?

No, I cannot reproduce the issue in the Example app

Additional information

mrousavy commented 2 weeks ago
  1. Why did you not post your react-native-worklets-core version?
  2. You need react-native-worklets-core 1.x.x for V4, and 0.x.x for V3 (you are on V4, so react-native-worklets-core 1.x.x)
  3. Might also be a good idea to upgrade your RN version to 0.72 or 0.73, but 0.71 should be good.
Tymofiev commented 2 weeks ago

@mrousavy I did not add react-native-worklets-core version because I am not using any frame processors and don't have it installed, is that dependency required anyway?

The RN upgrade is coming soon, but I thought it might be helpful information if it's not working with older versions for some reason...

ps: thanks for answering so fast!

mrousavy commented 2 weeks ago

Ah okay, well I didn't know if you are using FPs or not because you chose to ignore the required "reproduceable code" section: image

Tymofiev commented 2 weeks ago

@mrousavy I am so sorry for that! I just wasn't sure what to put in there since it's pretty basic rendering of Camera component with just a few props. Updated the description.

PS: btw I think there is a typo in Reproduceable section title

Sharf8351 commented 3 days ago

@Tymofiev I'm facing the same issue and using react native v 0.72.6 how did you fix it? Can you please help me? Thanks in advance :)

lsps9150414 commented 2 days ago

Update

It worked after running eas build again AFTER installing react-native-worklets-core. but I'm still unsure why it is needed in the first place without using frame processing.


Hey I am running into the same situation seeing the Error: react-native-worklets-core is not installed! following the Expo installation steps on https://react-native-vision-camera.com/docs/guides

I'm simply trying to render the camera without using the frame processing so I don't think I need to install react-native-worklets-core neither does the installation guide mentioned it.

I'm confused, so is react-native-worklets-core required anyway? What's worse for me is that the error persist even after I installed it πŸ˜…

Here are my dependencies:

"react": "18.2.0",
"react-native": "0.72.6",
"expo": "^49.0.21",
"react-native-vision-camera": "^4.0.4",
"react-native-worklets-core": "^1.3.3",
"react-native-reanimated": "^3.6.1",

my babel.config:

module.exports = function (api) {
  api.cache(true);
  return {
    presets: ["babel-preset-expo"],
    plugins: [
      "expo-router/babel",
      "react-native-reanimated/plugin",
      ["react-native-worklets-core/plugin"],
    ],
  };
};

I am testing on a real iOS device with a Expo dev build that I built after installing react-native-vision-camera but the react-native-worklets-core is installed after. I did restart my metro tho.

Tymofiev commented 2 days ago

@Sharf8351 I was just about to test in on the new version of RN... but if you are saying it still requires react-native-worklets-core then I don't know how to fix it right now other than adding that package...

mrousavy commented 2 days ago

It does not require react-native-worklets-core - try latest VisionCamera. That builds perfectly fine without Worklets.

Tymofiev commented 2 days ago

Just tested and seems to work without react-native-worklets-core on "react-native": "0.73.6" with "react-native-vision-camera": "4.0.4".