1

I am trying to update my react project to an updated version and I am facing the following error:

ERROR in ./node_modules/react-dom/index.js
Module not found: Error: Can't resolve 'react/lib/ReactDOM' in 'C:\Users\serole\Desktop\latest_react\app\node_modules\react-dom'
 @ ./node_modules/react-dom/index.js 3:17-46
 @ ./src/index.js
 @ multi babel-polyfill webpack/hot/dev-server webpack-dev-server/client?http://0.0.0.0:8080/ ./src/index
i 「wdm」: Failed to compile.
i 「wdm」: Compiling...
Amit Yadav
  • 4,422
  • 5
  • 34
  • 79

3 Answers3

0

you can remove node modules and install like this

npm install react-dom@latest react@latest --save 

try to install your all package like this

it's working for me

0

To install react-dom run the below command:

npm install react-dom --save

Now try checking the package.json for react-dom.

Amit Yadav
  • 4,422
  • 5
  • 34
  • 79
0

You have to remove node_modules and package-lock.json.

Then try to install all modules using npm install.

And make sure in you package.json contains following modules,

"react": "^16.8.6",
"react-dom": "^16.8.6",

Use this to install react and react-dom:

npm install react react-dom --save

Make sure that your react and react-dom packages have the same version to avoid incompatibility.

For more help to check here.

Hope this will help you.

Santosh Shinde
  • 6,045
  • 7
  • 44
  • 68