React Native 0.64 FBReactNativeSpec SyntaxError: Unexpected token ) PhaseScriptExecution

Viewed 849

I am unable to run a brand new React Native project in an iOS simulator.


Here's my environment:

  • OS: macOS Big Sir 11.2.3
  • NodeJS: 15.14.0
  • react-native: 0.64.0
  • react-native-cli: 2.0.1

Here's what I am doing:

  • Create a new react native project using react-native init FooBar.
  • Run the project in iOS using react-native run-ios

After that I get the following error:

FBReactNativeSpec Error

/Volumes/Projects/FooBar/node_modules/react-native-codegen/lib/cli/combine/combine-js-to-schema-cli.js:25
  );
  ^

SyntaxError: Unexpected token )
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:373:25)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Function.Module.runMain (module.js:441:10)
    at startup (node.js:139:18)
    at node.js:974:3
Command PhaseScriptExecution failed with a nonzero exit code
1 Answers

Turns out the problem lies with a bug with Facebook's React Native version 0.64.

The culprit is: node_modules/react-native/scripts/find-node.sh.

The temporary workaround until Facebook fixes it is to remove the contents of the file without deleting the file. I've automated this with the following script:

echo '' > node_modules/react-native/scripts/find-node.sh # Fix for React Native 0.64.0 (until Facebook fixes it)
Related