question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RN 0.64 FBReactNativeSpec - Syntax Error: Invalid regular expression

See original GitHub issue

Please provide all the information requested. Issues that do not follow this format are likely to stall.

Description

I’m upgrading to RN 0.64.0 (by following the upgrade helper). When building my iOS app via Xcode, I get the following error from FBReactNativeSpec:

>>>>> Generating schema from flow types


/Users/<user>/<project>/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>)
    at buildSchema (/Users/<user>/<project>/node_modules/react-native-codegen/lib/parsers/flow/index.js:220:19)
    at Object.parseFile (/Users/<user>/<project>/node_modules/react-native-codegen/lib/parsers/flow/index.js:276:10)
    at files.reduce (/Users/<user>/<project>/node_modules/react-native-codegen/lib/cli/combine/combine-js-to-schema.js:75:35)
    at Array.reduce (<anonymous>)
    at combineSchemas (/Users/<user>/<project>/node_modules/react-native-codegen/lib/cli/combine/combine-js-to-schema.js:66:16)
    at Object.<anonymous> (/Users/<user>/<project>/node_modules/react-native-codegen/lib/cli/combine/combine-js-to-schema-cli.js:90:40)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
Command PhaseScriptExecution failed with a nonzero exit code

React Native version:

System:
    OS: macOS 10.15.7
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 460.01 MB / 32.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 12.20.1 - ~/.nvm/versions/node/v12.20.1/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 6.14.10 - ~/.nvm/versions/node/v12.20.1/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: 28, 29, 30
      Build Tools: 28.0.3, 29.0.2, 30.0.3
      System Images: android-30 | Google APIs Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: 4.1 AI-201.8743.12.41.7042882
    Xcode: 12.4/12D4e - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_281 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found (installed globally) 
    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

Steps To Reproduce

Provide a detailed list of steps that reproduce the issue.

  1. Follow upgrade helper tool for RN 0.64.0
  2. yarn install
  3. pod install
  4. Build iOS (Xcode and react-native run-ios give the same error)

Expected Results

Build to succeed

Snack, code example, screenshot, or link to a repository:

Error described above. Another user created a similar issue in the rn-cli repo: https://github.com/react-native-community/cli/issues/1378

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:8
  • Comments:8

github_iconTop GitHub Comments

26reactions
vcmoraescommented, Apr 18, 2021

Run: “yarn add --dev react-native-codegen” and rebuild IOS project

9reactions
igormontellacommented, Mar 18, 2021

I got the same error here.

This is an dependency error on react-native@0.64.0. I’ve updated react-native-codegen to version 0.0.7 and the error goes away.

I use yarn so I put it on resolver attribute inside package.json.

Read more comments on GitHub >

github_iconTop Results From Across the Web

react-native start giving Invalid regular expression invalid error
There is a problem with Metro using some NPM and Node versions. You hay 2 alternatives: Alternative 1: Uninstall node and npm and...
Read more >
Invalid group specifier name no stack? : r/reactnative - Reddit
How can I fix this error?Invalid regular expression: Invalid group specifier name no stack I run the application without error on terminal ...
Read more >
Command Phasescriptexecution Failed With A ... - ADocLib
RN 0.64 FBReactNativeSpec Syntax Error : Invalid regular expression. Description. React Native version: Steps To Reproduce. Expected Results. Snack code.
Read more >
command phasescriptexecution failed with a ... - You.com
React Native - FBReactNativeSpec Command PhaseScriptExecution failed with a ... bundle output info Copying 38 asset files error invalid options argument.
Read more >
No podspec found for fbreactnativespec in node modules ...
... RN upgrade; 0.64.0 pod install failed #31440; FBReactNativeSpec error ... 'g'); ^ SyntaxError: Invalid regular expression: /TurboModuleRegistry\s*\.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found