Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Proper mechanism to downgrade react-native

Tags:

My situation is this :

I had a working copy of a react-native project that was working well. Had it commited to my git repository.

I decided to upgrade react-native to 0.26.3 and then 0.28 and finally ended up in a big dependency mess with collisions. So decided to go back to previous working version. Reverted the changes. Removed node_modules folder from my working directory.

But now npm install just won't work.

My working dependencies in package.json

  "dependencies": {     "immutable": "^3.8.1",     "key-mirror": "^1.0.1",     "react": "^15.0.2",     "react-native": "^0.26.0",     "react-native-router-flux": "^3.26.1",     "react-redux": "^4.4.5",     "redux": "^3.5.2",     "redux-thunk": "^2.1.0",     "strformat": "0.0.7"   },   "devDependencies": {     "babel-core": "^6.10.4",     "babel-jest": "^12.1.0",     "babel-preset-es2015": "^6.9.0",     "babel-preset-react-native": "^1.9.0",     "babel-register": "^6.9.0",     "chai": "^3.5.0",     "fetch-mock": "^4.5.4",     "jest-cli": "^12.1.1",     "mocha": "^2.5.3",     "mockery": "^1.7.0",     "nock": "^8.0.0",     "redux-mock-store": "^1.1.1",     "sinon": "^1.17.4",     "sinon-chai": "^2.8.0",     "sinon-stub-promise": "^2.0.0"   } 

Now I get

npm ERR! peerinvalid The package [email protected] does not satisfy its siblings' peerDependencies requirements! npm ERR! peerinvalid Peer [email protected] wants [email protected] npm ERR! peerinvalid Peer [email protected] wants react@^0.14.0 || ^15.0.0-0 

This just not makes sense to me, as my react dependency is 15.0.2 and react-native 0.26.0 as you can see in package.json.

Note that this is from a previous commit that was working (the whole lot). I also did a npm ls. Weirdly wrong dependencies are shown in the tree like wrong versions of react-native, react-native-router-flux, react.

link to ls output

like image 864
Sathyakumar Seshachalam Avatar asked Jun 25 '16 01:06

Sathyakumar Seshachalam


People also ask

How do I downgrade my react native?

Search the “react-dom” and “react” packages under dependencies or devDependencies, before replacing them with 16.13. 0. Next, run “yarn” or “npm install” or any package manager to downgrade your React to 16.

How do I downgrade to react to lower?

Search for the react and react-dom packages under dependencies (or devDependencies ) and replace their versions with 16.13. 0 . Then run npm install or yarn or whatever package manager you're using. This should be enough to downgrade to React 16.

How do I downgrade from react 17 to 16?

To downgrade React version 17 to 16 If You Don't want to use React 17 Then Just downgrade to react 16 Just run this command in your terminal: npm install –save [email protected] [email protected] Now, Your react version is downgraded to React 16. Thank you.


1 Answers

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

like image 57
chetan Avatar answered Sep 21 '22 16:09

chetan