代码之家  ›  专栏  ›  技术社区  ›  Vojtěch Dohnal

ReactDOM.render:在React从16.4.2升级到16.5.2之后,在未安装的组件上找不到节点

  •  7
  • Vojtěch Dohnal  · 技术社区  · 6 年前

    我已经将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:在未安装的组件上找不到节点。

    以下是my 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"
      }
    }
    


    npm install  @material-ui/icons@3.0.1
    npm install  @material-ui/core@3.2.0
    npm cache clean --force
    

    npm过时 只显示错误。

    也尝试过(没有任何收获):

    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
    

    但这意味着我无法升级。还尝试了另一台计算机与相同的项目和相同的错误出来。

    2 回复  |  直到 6 年前
        1
  •  3
  •   Demiurg77    6 年前

    我也有同样的问题。最后将React和React dom升级到16.6.0。

        2
  •  2
  •   Vojtěch Dohnal    6 年前

    我建议卸载/删除损坏的软件包并安装更新的软件包。

    npm uninstall --save react-dom
    npm uninstall --save react
    npm install react-dom@16.4.2
    npm install react@16.4.2