问题
I recently upgraded to react 16.2.0
from react 15.6.2
Now my application doesnt work as expected and has lot of warnings for dependancies on react 15.6.2
So for me now its not possible to upgrade all other dependencies to 16.2.0.
because of the time schedule.
Hence I want to downgrade to react 15.6.2
I ran following commands to install react 15.6.2 again:
npm install react@^15.6.2
I am getting following error :
+-- UNMET PEER DEPENDENCY react@15.6.2 invalid
`-- UNMET PEER DEPENDENCY react-dom@16.2.0
When I update my package.json to "react": "^15.6.2"
, I get following error:
npm ERR! Linux 3.13.0-36-generic
npm ERR! argv "/home/rakesh/.nvm/versions/node/v6.9.4/bin/node" "/home/rakesh/.nvm/versions/node/v6.9.4/bin/npm" "install"
npm ERR! node v6.9.4
npm ERR! npm v3.10.10
npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! notsup Valid OS: darwin
npm ERR! notsup Valid Arch: any
npm ERR! notsup Actual OS: linux
npm ERR! notsup Actual Arch: x64
npm ERR! Please include the following file with any support request:
npm ERR! /home/rakesh/rockethire/development/codebase/recruitment/rh-react/npm-debug.log
Below is my package.json
{
"name": "rh-react",
"version": "1.0.0",
"description": "Pages accessible for outside world",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "webpack -d --watch",
"build": "sh -ac '. .env; webpack -d'",
"build:test": "sh -ac '. .env.test; webpack -p'",
"build:prod": "sh -ac '. .env.prod; webpack -p'"
},
"author": "",
"license": "ISC",
"dependencies": {
"ag-grid": "^13.3.1",
"ag-grid-react": "^13.3.0",
"axios": "^0.17.1",
"babel-loader": "^7.1.2",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"bootstrap": "^3.3.7",
"classnames": "^2.2.5",
"dotenv": "^4.0.0",
"fsevents": "^1.1.3",
"jquery": "^3.2.1",
"moment": "^2.19.1",
"query-string": "^5.0.0",
"react": "^16.2.0",
"react-async-script-loader": "^0.3.0",
"react-click-outside": "^3.0.0",
"react-cookies": "^0.1.0",
"react-datepicker": "^0.61.0",
"react-datetime": "^2.11.1",
"react-dom": "^16.2.0",
"react-dom-factories": "^1.0.2",
"react-dropzone": "^4.2.3",
"react-dropzone-component": "^3.0.0",
"react-moment": "^0.6.5",
"react-notifications": "^1.4.3",
"react-nvd3": "^0.5.7",
"react-router": "^2.8.1",
"react-router-dom": "^4.2.2",
"react-scripts": "^1.0.17",
"react-select": "^1.0.0-rc.10",
"react-select2-wrapper": "^1.0.4-beta5",
"reactjs-localstorage": "0.0.5",
"webpack": "^3.9.1",
"whatwg-fetch": "^2.0.3"
},
"devDependencies": {
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
"babel-preset-env": "^1.6.0",
"babel-preset-stage-0": "^6.24.1",
"compression-webpack-plugin": "^1.0.1",
"css-loader": "^0.28.7",
"eslint": "^4.11.0",
"eslint-plugin-react": "^7.5.1",
"style-loader": "^0.19.0",
"uglifyjs-webpack-plugin": "^1.1.2",
"webpack": "^3.6.0",
"webpack-bundle-analyzer": "^2.9.1"
}
}
Anyone has idea why I am unable to downgrade?
回答1:
I fixed this issue with the help of @HarshMakadia
and @nkr
.Thanks to both of them. Here is the solution for any other person facing the same problem.
1.Delete/Rename your current node_modules
folder.
2.Run npm cache clean
/ sudo npm cache clean
(Ubuntu 14.04)
3.Manually update your package.json
to change version of react and react-dom from 16.0.2 to 15.6.2
4.Run npm install
/sudo npm install
(Ubuntu 14.04)
Note: Add your node_modules folder to any VCS like git to prevent from such issue
来源:https://stackoverflow.com/questions/49252594/downgrade-to-react-15-6-2-from-react-16-2-0-failed