我已将 ReactJS 项目更新到最新版本,npm update
并从 Visual Studio 2017 运行,结果如下:
+ @material-ui/icons@2.0.3
+ react-dom@16.5.2
+ @material-ui/core@1.5.1
+ react@16.5.2
+ @aspnet/signalr@1.0.4
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 后如何修复此错误?
我做了
npm install @material-ui/icons@3.0.1
npm install @material-ui/core@3.2.0
npm cache clean --force
现在npm outdated
什么也没显示,但错误仍然存在。
也尝试过(没有任何收获):
npm uninstall --save react-dom
npm uninstall --save react
npm install react-dom
npm install react
唯一“有效”的是降级
npm install react-dom@16.4.2
npm install react@16.4.2
但这意味着我无法升级。还尝试了另一台具有相同项目的计算机,但出现了相同的错误。