我已将 ReactJS 项目更新到最新版本npm update
从 Visual Studio 2017 运行,结果如下:
+ @material-ui/[email protected] /cdn-cgi/l/email-protection
+ [email protected] /cdn-cgi/l/email-protection
+ @material-ui/[email protected] /cdn-cgi/l/email-protection
+ [email protected] /cdn-cgi/l/email-protection
+ @aspnet/[email protected] /cdn-cgi/l/email-protection
added 4 packages from 3 contributors, removed 10 packages, updated 20 packages and audited 185 packages in 23.309s
found 0 vulnerabilities
当我跑步时npm outdated
我仍然得到:
Package Current Wanted Latest Location
@material-ui/core 1.5.1 1.5.1 3.2.0 Dixie
@material-ui/icons 2.0.3 2.0.3 3.0.1 Dixie
现在,当我运行该项目时,该项目在更新之前有效,我得到
ReactDOM.render:无法在已卸载的组件上找到节点。
这是我的 package.json:
{
"name": "Dixie",
"version": "0.1.0",
"private": true,
"dependencies": {
"bootstrap": "^3.3.7",
"react": "^16.4.1",
"react-bootstrap": "^0.31.5",
"react-dom": "^16.4.1",
"react-router-bootstrap": "^0.24.4",
"react-router-dom": "^4.2.2",
"react-scripts": "^1.1.4",
"rimraf": "^2.6.2"
},
"scripts": {
"start": "rimraf ./build && react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
}
React 更新到 16.5.2 后如何修复此错误?
I did
npm install @material-ui/[email protected] /cdn-cgi/l/email-protection
npm install @material-ui/[email protected] /cdn-cgi/l/email-protection
npm cache clean --force
now npm outdated
什么也没显示,但错误仍然存在。
也尝试过(没有任何收获):
npm uninstall --save react-dom
npm uninstall --save react
npm install react-dom
npm install react
唯一“有效”的就是降级
npm install [email protected] /cdn-cgi/l/email-protection
npm install [email protected] /cdn-cgi/l/email-protection
但这意味着我无法升级。还尝试了另一台具有相同项目的计算机,也出现了相同的错误。