问题描述
我最近从 react 15.6.2
升级到 react 16.2.0
现在我的应用程序没有按预期工作,并且对 react 15.6.2
的依赖有很多警告所以对我来说,由于时间安排,现在不可能将所有其他依赖项升级到 16.2.0.
.因此我想降级以响应 15.6.2
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
我运行以下命令再次安装 react 15.6.2:
I ran following commands to install react 15.6.2 again:
npm install react@^15.6.2
我收到以下错误:
+-- UNMET PEER DEPENDENCY [email protected] invalid
`-- UNMET PEER DEPENDENCY [email protected]
当我将 package.json 更新为 "react": "^15.6.2"
时,出现以下错误:
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 [email protected]: 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
下面是我的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?
推荐答案
我在 @HarshMakadia
和 @nkr
的帮助下解决了这个问题.感谢他们.这是任何其他面临相同问题的人的解决方案.
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.删除/重命名您当前的 node_modules
文件夹.
2.运行npm cache clean
/sudo npm cache clean
(Ubuntu 14.04)
3.手动更新您的 package.json
以将 react 和 react-dom 的版本从 16.0.2 更改为 15.6.2
4.运行npm install
/sudo npm install
(Ubuntu 14.04)
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)
注意:将您的 node_modules 文件夹添加到任何像 git 这样的 VCS 以防止此类问题
Note: Add your node_modules folder to any VCS like git to prevent from such issue
这篇关于从 react 16.2.0 降级到 react 15.6.2 失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!