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: new NativeEventEmitter() requires a non-null argument., js engine: hermes ERROR Invariant Violation: new NativeEventEmitter() requires a non-null argument., js engine: hermes #2241

Closed
Keerthirathinam opened this issue Jan 5, 2025 · 3 comments

Comments

@Keerthirathinam
Copy link

I installed react-native-background-geolocation then did pod install

I am getting this error blocked here.

@christocracy
Copy link
Member

The issue template is not optional -- it's required:

Your Environment

  • Plugin version:
  • Platform: iOS or Android
  • OS version:
  • Device manufacturer / model:
  • React Native version (react-native -v):
  • Plugin config
PASTE_YOUR_CODE_HERE

Expected Behavior

Actual Behavior

Steps to Reproduce

Context

Debug logs

Logs
PASTE_YOUR_LOGS_HERE

@Keerthirathinam
Copy link
Author

Keerthirathinam commented Jan 5, 2025

  • Plugin version: 4.18.3
  • Platform: iOS
  • OS version: iOS 18.1.1
  • Device manufacturer / model: iPhone 15 Pro
  • React Native version (react-native -v): 0.72.10
  • Xcode version: 16.2

Actual Behavior:
Just installed the plugin and tried to run it in physical device

here is my Pod File

require File.join(File.dirname(`node --print "require.resolve('expo/package.json')"`), "scripts/autolinking")
$RNFirebaseAsStaticFramework = true
def node_require(script)
  # Resolve script with node to allow for hoisting
  require Pod::Executable.execute_command('node', ['-p',
    "require.resolve(
      '#{script}',
      {paths: [process.argv[1]]},
    )", __dir__]).strip
end

node_require('react-native/scripts/react_native_pods.rb')
node_require('react-native-permissions/scripts/setup.rb')

platform :ios, '13.4'
prepare_react_native_project!

setup_permissions([
  'LocationWhenInUse',
  'Always',
  'Notifications'
])

# If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set.
# because `react-native-flipper` depends on (FlipperKit,...) that will be excluded
#
# To fix this you can also exclude `react-native-flipper` using a `react-native.config.js`
# ```js
# module.exports = {
#   dependencies: {
#     ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}),
# ```
flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled

linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
  Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
  use_frameworks! :linkage => linkage.to_sym
end

target 'sampleTest' do
  use_expo_modules!
  post_integrate do |installer|
    begin
      expo_patch_react_imports!(installer)
    rescue => e
      Pod::UI.warn e
    end
  end

  # React Native Maps dependencies
  rn_maps_path = '../node_modules/react-native-maps'
  pod 'react-native-google-maps', :path => rn_maps_path

  config = use_native_modules!

  # Flags change depending on the env values.
  flags = get_default_flags()

  # Workaround for firebase modules w/o use_frameworks!
  pod 'FirebaseCore', :modular_headers => true;
  pod 'GoogleUtilities', :modular_headers => true;
  pod 'FirebaseABTesting', :modular_headers => true;
  pod 'FirebaseInstallations', :modular_headers => true;

  use_react_native!(
    :path => config[:reactNativePath],
    # Hermes is now enabled by default. Disable by setting this flag to false.
    :hermes_enabled => flags[:hermes_enabled],
    :fabric_enabled => flags[:fabric_enabled],
    # Enables Flipper.
    #
    # Note that if you have use_frameworks! enabled, Flipper will not work and
    # you should disable the next line.
    # https://github.com/facebook/react-native/issues/43335
    # :flipper_configuration => flipper_config,
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  post_install do |installer|
    # installer.pods_project.targets.each do |target|
    #   if target.name == 'react-native-google-maps'
    #     target.build_configurations.each do |config|
    #       config.build_settings['CLANG_ENABLE_MODULES'] = 'No'
    #     end
    #   end
    # end
    # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
    react_native_post_install(
      installer,
      config[:reactNativePath],
      :mac_catalyst_enabled => false
    )
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
  end
end

@christocracy
Copy link
Member

Create for me a simple "hello-world" app which reproduces this. Post to a public Github repo and share it with me here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants