After upgrading react-native from 0.48.3 to 0.62.2 I get the error when running "react-native run-ios" command: "index.js: Transformer.transform is not a function".

System:
OS: macOS 10.15.1
CPU: (4) x64 Intel(R) Core(TM) i5-6267U CPU @ 2.90GHz
Memory: 75.33 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 12.16.3 - /usr/local/bin/node
Yarn: 1.22.4 - /usr/local/bin/yarn
npm: 6.14.4 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.9.3 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
Android SDK: Not Found
IDEs:
Android Studio: 4.0 AI-193.6911.18.40.6514223
Xcode: 11.2.1/11B500 - /usr/bin/xcodebuild
Languages:
Java: 11.0.7 - /usr/bin/javac
Python: 2.7.16 - /usr/bin/python
npmPackages:
@react-native-community/cli: Not Found
react: ^16.11.0 => 16.11.0
react-native: ^0.62.2 => 0.62.2
npmGlobalPackages:
react-native: Not Found
Do you need help upgrading to a newer React Native version? Visit the Upgrade Support repository or use the upgrade helper to see the changes that need to be made to upgrade your app.
@popdorin Why was this closed? Did you figure out the solution?
I'm experiencing the same issue.
Thanks
@SudoPlz I'm not sure why this was closed but I didn't find the solution yet. I used the upgrade helper but I still get the same error.
I'm getting this same error on a new install (new MacBook Pro). Did anyone find a solution?
Same there ... Using upgrade helper to align versions, and still doesn't work
@abouquet I was finally able to get around the errors (after a lot of digging and searching). As I mentioned, my issue started when I attempted to set my app up on a new laptop...which had the latest install of React Native (0.63). Here are the steps that got me back up and running (once I made it past the transformer error, I started getting a swift error, so the steps below include the fix for that too):
Now, I turned my attention to the pod files
Now, this is where I started getting the swift linking errors. You can read more about the details here (https://stackoverflow.com/questions/50096025/it-gives-errors-when-using-swift-static-library-with-objective-c-project/56187043#56187043). To get around this, I had to do the following:
I continued to get errors for my "tests", so I had to make one additional change.
The above steps worked for me. Good luck!
thanks @rgreen33 for your detailed explanation !
I will try theses steps asap.
Having similar issue on Windows.
For us this was caused by a version mismatch of the metro-config package. If you depend on this in your app to override some default metro configuration you should make sure it's the same version react-native depends on.
In our case we upgraded to [email protected] and also upgraded metro-config to 0.61, although react-native depended on 0.58. This caused the metro version used by the react-native CLI to try to load a transformer module from a path that does not exist for 0.58, returning undefined from the require call, leading to the error in question.
You can check which versions are required and installed by running npm ls metro-config or searching the package-lock.json file.
For us this was caused by a version mismatch of the
metro-configpackage. If you depend on this in your app to override some default metro configuration you should make sure it's the same versionreact-nativedepends on.
In our case we upgraded to[email protected]and also upgradedmetro-configto0.61, althoughreact-nativedepended on0.58. This caused the metro version used by the react-native CLI to try to load a transformer module from a path that does not exist for0.58, returningundefinedfrom therequirecall, leading to the error in question.You can check which versions are required and installed by running
npm ls metro-configor searching thepackage-lock.jsonfile.
worked for me , this save my life !
Hey, I had the same issue. Here is my solution:
"devDependencies": { "@babel/core": "^7.11.1", "@babel/runtime": "^7.11.2", "@react-native-community/eslint-config": "^1.1.0", "babel-jest": "^25.5.1", "eslint": "^6.8.0", "jest": "^25.5.4", "metro": "^0.61.0", "metro-core": "^0.61.0", "metro-react-native-babel-preset": "^0.59.0", "react-test-renderer": "16.13.1" }I'm still experiencing this problem. No clean or install helped!
EDIT: Nevermind, I still had the old version in cache. @automatensalat you saved my life.
del %appdata%Tempreact-native-* & cd android & gradlew clean & cd .. & del node_modules/ & npm cache clean --force & npm install & npm start -- --reset-cache
try to run this on your cmd.
It work for me.
For an explanation of the cause of the issue see here: https://github.com/facebook/metro/issues/617
Most helpful comment
For us this was caused by a version mismatch of the
metro-configpackage. If you depend on this in your app to override some default metro configuration you should make sure it's the same versionreact-nativedepends on.In our case we upgraded to
[email protected]and also upgradedmetro-configto0.61, althoughreact-nativedepended on0.58. This caused the metro version used by the react-native CLI to try to load a transformer module from a path that does not exist for0.58, returningundefinedfrom therequirecall, leading to the error in question.You can check which versions are required and installed by running
npm ls metro-configor searching thepackage-lock.jsonfile.