Skip to content

Can use Hermes on a new project #931

@ospfranco

Description

@ospfranco

Environment

react-native -v: 5.0.1
npm ls react-native-macos: 0.64.18
node -v: 16.12.0
npm -v: 8.1.0
yarn --version: 1.22.17
xcodebuild -version: 13.1

Steps to reproduce the bug

I created a new RN macOS project the other day, I wanted to start right away with Hermes, I followed the installation instructions and I got to the following issue:

https://stackoverflow.com/questions/68497865/rct-folly-error-when-using-hermes-with-ios

Debugging it is very confusing since all the info online points to flipper on iOS, but on macOS there is no flipper... anyways, I tried updating a bunch of things and had to resort to a similar solution to the one on the stack overflow answer on my Podfile:

require_relative '../node_modules/react-native-macos/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

# fixes for last Mac updates
def find_and_replace(dir, findstr, replacestr)
  Dir[dir].each do |name|
      text = File.read(name)
      replace = text.gsub(findstr,replacestr)
      if text != replace
          puts "Fix: " + name
          File.open(name, "w") { |file| file.puts replace }
          STDOUT.flush
      end
  end
  Dir[dir + '*/'].each(&method(:find_and_replace))
end

target 'messer-macOS' do
  platform :macos, '10.14'
  use_native_modules!
  use_react_native!(
    :path => '../node_modules/react-native-macos',
    :hermes_enabled => true
  )
  
  
  post_install do |installer|
    find_and_replace("Pods/Headers/Private/RCT-Folly/folly/synchronization/DistributedMutex-inl.h",
    "atomic_notify_one(state)", "folly::atomic_notify_one(state)")
  end
end

is there any plan to fix this (AFAIK RCT-Folly already fixed this in some of the later versions?)

Expected Behavior

No response

Actual Behavior

No response

Reproducible Demo

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions