'react native Cannot find module 'metro/src/reactNative Transformer'

When upgrading to RN 0.59.4 and after a successful build - one can encounter the following error in metro bundler:

react native Cannot find module 'metro/src/reactNative Transformer



Solution 1:[1]

I think there's an issue with the version of metro packaged with the latest RN Upgrade. I just installed locally in dev metro npm install --save-dev metro, which is the version 0.51.1, and that worked for me.

Reference: https://github.com/facebook/metro/issues/293#issuecomment-452779809

Solution 2:[2]

Make sure that you at least:

"metro-react-native-babel-preset": "0.53.1"
In dev dependencies in your package.json file

Solution 3:[3]

I solved the problem by deleting the node_modules folder and the package-lock.json file and then running again npm install

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Md. Robi Ullah
Solution 2 Erab BO
Solution 3 sergioriverafl