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

FBReactNativeSpec codegen error withTurboModuleRegistry after upgrading from 0.63.4 to 0.64.0 #139

Closed
1 task done
smacgregor opened this issue Mar 15, 2021 · 2 comments
Closed
1 task done
Labels

Comments

@smacgregor
Copy link

Environment

System:
    OS: macOS 10.15.7
    CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
    Memory: 759.72 MB / 16.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 12.0.0 - /var/folders/np/m5_nwf2x47d5sfrhzzt1rt100000gn/T/yarn--1615818655543-0.8649980341704646/node
    Yarn: 1.16.0 - /var/folders/np/m5_nwf2x47d5sfrhzzt1rt100000gn/T/yarn--1615818655543-0.8649980341704646/yarn
    npm: 6.9.0 - ~/.nvm/versions/node/v12.0.0/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.10.1 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 14.4, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2
    Android SDK:
      API Levels: 23, 24, 25, 26, 27, 28, 29, 30
      Build Tools: 23.0.1, 23.0.3, 25.0.2, 25.0.3, 26.0.1, 26.0.2, 26.0.3, 27.0.3, 28.0.3, 29.0.2, 29.0.3
      System Images: android-25 | Google APIs ARM EABI v7a, android-25 | Google APIs Intel x86 Atom, android-27 | Google APIs Intel x86 Atom, android-29 | Google APIs Intel x86 Atom
      Android NDK: 22.0.7026061
  IDEs:
    Android Studio: 4.1 AI-201.8743.12.41.6953283
    Xcode: 12.4/12D4e - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_131 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.1 => 17.0.1
    react-native: 0.64.0 => 0.64.0
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Things I’ve done to figure out my issue

Upgrading version

0.64.0

Description

I'm experiencing a codegen issue with FBReactNativeSpec - different from #138. Building from an xcode work space. Only happening on Release - Debug is working.

>>>>> Generating schema from flow types
node_modules/react-native-codegen/lib/parsers/flow/index.js:220
    const regex = new RegExp(TURBO_MODULE_REGISTRY_REQUIRE_REGEX_STRING, 'g');
                  ^
SyntaxError: Invalid regular expression: /TurboModuleRegistry\s*\.\s*get(Enforcing)?\s*<\s*Spec\s*>\s*\(\s*['"](?<nativeModuleName>[A-Za-z$_0-9]+)['"]\s*,?\s*\)/: Invalid group
    at new RegExp (<anonymous>)
@smacgregor
Copy link
Author

Our Jenkins system uses a NodeJS plugin to manage which version of node to use when building a job. The code generation build script wasn't respecting how that was being set and was finding an old version of node.

For those who run into this

export NODE_BINARY=`which node`

at the top of the execute shell script for our Jenkins job did the trick.

@noway
Copy link

noway commented May 25, 2021

Another option:

  1. Determine what your node binary is:
$ which node
/opt/homebrew/bin/node
  1. Add a fixer function in your Podfile:
def fix_fb_react_native_spec(installer)
  installer.pods_project.targets.each do |target|
    if target.name == 'FBReactNativeSpec'
      target.build_configurations.each do |config|
        if config.name == 'Debug' or config.name == 'Release'
          config.build_settings['NODE_BINARY'] = '/opt/homebrew/bin/node'
        end
      end
    end
  end
end
  1. In your postinstall, add fix_fb_react_native_spec(installer) like so:
  post_install do |installer|
    react_native_post_install(installer)
    fix_fb_react_native_spec(installer)
  end
  1. Pod install
  2. Rebuild (ideally with a clean build)

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

No branches or pull requests

2 participants