React native build error: Unexpected > token punc «:», expected punc «,» in file

Hitting this error when building for react native 0.62.2.

error node_modules/react-native/Libraries/Blob/URL.js: Unexpected token punc «:», expected punc «,» in file node_modules/react-native/Libraries/Blob/URL.js at 104:30. Run CLI with --verbose flag for more details. Error: Unexpected token punc «:», expected punc «,» in file node_modules/react-native/Libraries/Blob/URL.js at 104:30

Tried removing node_modules and yarn.lock, but to no avail. :(


Solution 1:

Issue is due to metro-react-native-babel-preset. update it to "metro-react-native-babel-preset": "^0.66.2"