mrousavy / react-native-vision-camera

📸 A powerful, high-performance React Native Camera library.
https://react-native-vision-camera.com
MIT License
7.6k stars 1.1k forks source link

🔧 Unable to find a specification for `react-native-worklets-core` depended upon by `VisionCamera/FrameProcessors` #3187

Open phazei opened 2 months ago

phazei commented 2 months ago

How were you trying to build the app?

pod install

Full build logs

> pod install

RNFBAnalytics: Using Firebase/AnalyticsWithoutAdIdSupport pod in place of default Firebase/Analytics
[VisionCamera] Thank you for using VisionCamera ❤️
[VisionCamera] If you enjoy using VisionCamera, please consider sponsoring this project: https://github.com/sponsors/mrousavy
[VisionCamera] $VCEnableLocation is not set, enabling CLLocation APIs by default...
[VisionCamera] $VCEnableFrameProcessors is not set, enabling Frame Processors if Worklets is installed...
[VisionCamera] react-native-worklets-core found at ., Frame Processors are enabled!
Auto-linking React Native modules for target `Abstract`: RNBootSplash, RNCAsyncStorage, RNCClipboard, RNCMaskedView, RNConvertPhAsset, RNDateTimePicker, RNDeviceInfo, RNFBAnalytics, RNFBApp, RNFBCrashlytics, RNFBDynamicLinks, RNFBMessaging, RNFS, RNFileViewer, RNGestureHandler, RNLocalize, RNNotifee, RNPermissions, RNReanimated, RNSVG, RNScreens, RNStaticSafeAreaInsets, RNVectorIcons, VisionCamera, react-native-audio, react-native-biometrics, react-native-cameraroll, react-native-contacts, react-native-detector, react-native-document-picker, react-native-heic-converter, react-native-maps, react-native-mov-to-mp4, react-native-netinfo, react-native-orientation-locker, react-native-paste-input, react-native-restart, react-native-safe-area-context, react-native-secure-key-store, react-native-startup-time, react-native-video, and toolbar-android
Framework build type is static library
[Codegen] Adding script_phases to React-Codegen.
[Codegen] Generating ./build/generated/ios/React-Codegen.podspec.json
[Codegen] Analyzing /Users/username/Projects/frontend-nx/apps/rn/package.json
[Codegen] Searching for codegen-enabled libraries in the app.
[Codegen] The "codegenConfig" field is not defined in package.json. Assuming there is nothing to generate at the app level.
[Codegen] Searching for codegen-enabled libraries in the project dependencies.
[Codegen] Found @react-native-async-storage/async-storage
[Codegen] Found @react-native-clipboard/clipboard
[Codegen] Found @react-native-community/datetimepicker
[Codegen] Found react-native
[Codegen] Found react-native-document-picker
[Codegen] Found react-native-gesture-handler
[Codegen] Found react-native-reanimated
[Codegen] Found react-native-safe-area-context
[Codegen] Found react-native-screens
[Codegen] Found react-native-svg
[Codegen] Found react-native-vector-icons
[Codegen] Found @react-native-camera-roll/camera-roll
[Codegen] Found react-native-permissions
[Codegen] Found @mattermost/react-native-paste-input

[Codegen] >>>>> Searching for codegen-enabled libraries in react-native.config.js
[Codegen] Processing rnasyncstorage
[Codegen] Searching for podspec in the project dependencies.
[Codegen] Supported Apple platforms: ios, macos, tvos, visionos for rnasyncstorage
[Codegen] Processing rnclipboard
[Codegen] Searching for podspec in the project dependencies.
[Codegen] Supported Apple platforms: ios, macos, tvos, visionos for rnclipboard
[Codegen] Processing RNDateTimePickerCGen
[Codegen] Searching for podspec in the project dependencies.
[Codegen] Supported Apple platforms: ios, visionos for RNDateTimePickerCGen
[Codegen] Processing FBReactNativeSpec
[Codegen] Searching for podspec in the project dependencies.
[Codegen] Processing rncore
[Codegen] Searching for podspec in the project dependencies.
[Codegen] Processing rndocumentpicker
[Codegen] Searching for podspec in the project dependencies.
[Codegen] Supported Apple platforms: ios for rndocumentpicker
[Codegen] Processing rngesturehandler_codegen
[Codegen] Searching for podspec in the project dependencies.
[Codegen] Supported Apple platforms: ios, macos, tvos, visionos for rngesturehandler_codegen
[Codegen] Processing rnreanimated
[Codegen] Searching for podspec in the project dependencies.
[Codegen] Supported Apple platforms: ios, macos, tvos, visionos for rnreanimated
[Codegen] Processing safeareacontext
[Codegen] Searching for podspec in the project dependencies.
[Codegen] Supported Apple platforms: ios, tvos, visionos for safeareacontext
[Codegen] Processing rnscreens
[Codegen] Searching for podspec in the project dependencies.
[Codegen] Supported Apple platforms: ios, tvos, visionos for rnscreens
[Codegen] Processing rnsvg
[Codegen] Searching for podspec in the project dependencies.
[Codegen] Supported Apple platforms: ios, macos, tvos, visionos for rnsvg
[Codegen] Processing RNVectorIconsSpec
[Codegen] Searching for podspec in the project dependencies.
[Codegen] Supported Apple platforms: ios, tvos, visionos for RNVectorIconsSpec
[Codegen] Processing rncameraroll
[Codegen] Searching for podspec in the project dependencies.
[Codegen] Supported Apple platforms: ios for rncameraroll
[Codegen] Processing rnpermissions
[Codegen] Searching for podspec in the project dependencies.
[Codegen] Supported Apple platforms: ios, tvos for rnpermissions
[Codegen] Processing PasteTextInputSpecs
[Codegen] Searching for podspec in the project dependencies.
[Codegen] Supported Apple platforms: ios for PasteTextInputSpecs
[Codegen] Generating Native Code for ios
[Codegen] Generated artifacts: /Users/username/Projects/frontend-nx/apps/rn/ios/build/generated/ios
[Codegen] Generating Native Code for ios
[Codegen] Generated artifacts: /Users/username/Projects/frontend-nx/node_modules/react-native/ReactCommon
[Codegen] Creating component provider.
[Codegen] Generated provider in: /Users/username/Projects/frontend-nx/node_modules/react-native/React/Fabric
[Codegen] Done.
Analyzing dependencies
RNFBAnalytics: Using Firebase/AnalyticsWithoutAdIdSupport pod in place of default Firebase/Analytics
[VisionCamera] Thank you for using VisionCamera ❤️
[VisionCamera] If you enjoy using VisionCamera, please consider sponsoring this project: https://github.com/sponsors/mrousavy
[VisionCamera] $VCEnableLocation is not set, enabling CLLocation APIs by default...
[VisionCamera] $VCEnableFrameProcessors is not set, enabling Frame Processors if Worklets is installed...
[VisionCamera] react-native-worklets-core found at ., Frame Processors are enabled!
[!] Unable to find a specification for `react-native-worklets-core` depended upon by `VisionCamera/FrameProcessors`

You have either:
 * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
 * mistyped the name or version.
 * not added the source repo that hosts the Podspec to your Podfile.

[!] [Codegen] warn: using experimental new codegen integration
Warning: command "pod install" exited with non-zero status code

Project dependencies

This is a huge 300 item list, but we're using RN 0.74.5

VisionCamera Version

4.5.3

Target platforms

iOS

Operating system

MacOS

Can you build the VisionCamera Example app?

I didn't try (⚠️ your issue might get ignored & closed if you don't try this)

Additional information

maintenance-hans[bot] commented 2 months ago

Guten Tag, Hans here! 🍻 It seems like you are having trouble with react-native-worklets-core while trying to build. Make sure your CocoaPods are up-to-date by running pod repo update or pod install --repo-update. Also, confirm that you have correctly added react-native-worklets-core in your Podfile.

Your issue is valid, but to really help mrousavy and get this sorted, could you please try building the VisionCamera Example app? It might provide more insights, and posting more detailed logs would be great too. Feel free to check out the Troubleshooting Guide for more tips!

Lastly, if you appreciate the work being done here, consider sponsoring the project here.

Note: If you think I made a mistake, please ping @mrousavy to take a look.

phazei commented 2 months ago

We do not use or need Frame Processors, so we don't want them enabled, but it seems to be thinking it's finding it and enabling it, then failing because it's not there.

pod install --repo-update didn't help

I also did a search for issues but since frame processors and the worklet are part of every single issues template, it makes it impossible to search for :(

phazei commented 2 months ago

I debugged it and discovered the issue. It's a bug in the Ruby because depending on how it's run, sometimes it returns "undefined" but other times it returns undefined which is not the string as well as multiple lines.

I modified the podspec like so:

def Pod::getWorkletsLibraryPath
  installation_root = Pod::Config.instance.installation_root.to_s
  Pod::UI.puts "[VisionCamera Debug] Installation root: #{installation_root}"

  command = "cd \"#{installation_root}\" && node --print \"try { console.log(require.resolve('react-native-worklets-core/package.json')) } catch(e) { console.log('PACKAGE_NOT_FOUND') }\""
  Pod::UI.puts "[VisionCamera Debug] Executing command: #{command}"

  output = `#{command}`
  Pod::UI.puts "[VisionCamera Debug] Command output: #{output}"
  Pod::UI.puts "[VisionCamera Debug] Output lines: #{output.strip.lines.map(&:inspect).join(', ')}"

  if output.lines.any? { |line| line.strip == 'PACKAGE_NOT_FOUND' }
    Pod::UI.puts "[VisionCamera Debug] Package not found"
    return nil
  elsif output.lines.any? { |line| line.include?('node_modules/react-native-worklets-core/package.json') }
    path = output.lines.find { |line| line.include?('node_modules/react-native-worklets-core/package.json') }.strip
    Pod::UI.puts "[VisionCamera Debug] Package found at: #{path}"
    return File.dirname(path)
  else
    Pod::UI.puts "[VisionCamera Debug] Unexpected output, assuming package not found"
    return nil
  end
end

It outputs:

[VisionCamera] Thank you for using VisionCamera ❤️
[VisionCamera] If you enjoy using VisionCamera, please consider sponsoring this project: https://github.com/sponsors/mrousavy
[VisionCamera] $VCEnableLocation is not set, enabling CLLocation APIs by default...
[VisionCamera] $VCEnableFrameProcessors is not set, enabling Frame Processors if Worklets is installed...
[VisionCamera Debug] Installation root: /Users/username/Projects/frontend-nx/apps/rn/ios
[VisionCamera Debug] Executing command: cd "/Users/username/Projects/frontend-nx/apps/rn/ios" && node --print "try { console.log(require.resolve('react-native-worklets-core/package.json')) } catch(e) { console.log('PACKAGE_NOT_FOUND') }"
[VisionCamera Debug] Command output: PACKAGE_NOT_FOUND
undefined
[VisionCamera Debug] Output lines: "PACKAGE_NOT_FOUND\n", "\e[90mundefined\e[39m"
[VisionCamera Debug] Package not found
[VisionCamera] react-native-worklets-core not found - Frame Processors are disabled!

The bug in the original code is "output.strip" doesn't actually work properly in all cases when it outputs multiple lines which can happen. I tried it without outputting text, but it was inconsistent.

ameesme commented 1 week ago

I have been experiencing the same issue. Upgrading to version 4.6.1 addressed the issue for me.