Proper mechanism to downgrade react-native
Please update your react
dependency in package.json to explicitly be 15.0.2
, not ^15.0.2
since the latter resolves to 15.1.0
which causes this issue. It is recommended to leave it that way until you upgrade for the next time and get this error once again (to avoid react
changing its version in the meantime and react-native
not being ready for it).
Also, with npm3 EPEERINVALID
is no longer an error, but warning.
Downgrading React Native requires manual steps. I recommend using https://react-native-community.github.io/upgrade-helper/. here are my steps
- Set your current version as base and select the previous minor release of react-native (You should downgrade one version at a time, it's not very easy to downgrade from 0.61.x to 0.59.x or lower using this method)
- Revert all the changes made to files as displayed in the compare view
- Delete node_modules folder, clear watchman, reset metro cache, Clear ios cached files and Android cached file.
yarn
ornpm install
- Test that both iOS and Android version are working
- (if needed) Repeat the steps to downgrade to another lower version
Important: If you're downgrading multiple versions then you should downgrade one version at a time. For example, downgrading from 0.61.x to 0.58.x, should towngrade to version 0.60.x first, test that it works in iOS and Android then move on and downgrade to version 0.59.x
For existing projects if you want to install/downgrade to lower version
npm install [email protected] ex: npm install [email protected]
This will install the version specified.
Check the installed version with react-native --version
Update 2020
Just run
npm install [email protected]
Replace 0.43.8
with version you need.