Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ReactDOM.render: Unable to find node on an unmounted component after React upgrade from 16.4.2 to 16.5.2

I have updated ReactJS project to the latest version with npm update running from Visual Studio 2017 with following results:

+ @material-ui/[email protected]
+ [email protected]
+ @material-ui/[email protected]
+ [email protected]
+ @aspnet/[email protected]
added 4 packages from 3 contributors, removed 10 packages, updated 20 packages and audited 185 packages in 23.309s
found 0 vulnerabilities

When I run npm outdated I still get:

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

Now when I run the project, that worked before update, I get

ReactDOM.render: Unable to find node on an unmounted component.

Here's 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"
  }
}

How to fix this error after React update to 16.5.2?


I did

npm install  @material-ui/[email protected]
npm install  @material-ui/[email protected]
npm cache clean --force

now npm outdated shows nothing but the error remains.

Tried also (without any gain):

npm uninstall --save react-dom
npm uninstall --save react
npm install react-dom
npm install react

The only thing that "works" is downgrade

npm install [email protected]
npm install [email protected]

But it means I am unable to upgrade. Tried also another computer with the same project and the same error came out.

like image 746
Vojtěch Dohnal Avatar asked Oct 10 '18 07:10

Vojtěch Dohnal


2 Answers

I had the same issue. Finally upgrade React and React-dom to 16.6.0 helped.

like image 64
Demiurg77 Avatar answered Oct 29 '22 20:10

Demiurg77


I would recommend to uninstall/remove the broken packages and install updated one.

You can downgrade React to 16.4.2. this way:

npm uninstall --save react-dom
npm uninstall --save react
npm install [email protected]
npm install [email protected]
like image 35
Mustkeem K Avatar answered Oct 29 '22 19:10

Mustkeem K