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
  • + react@16.8.6 + react-dom@0.14.9,,,,the are installed – Satish Ameda Jul 10 '19 at 07:19
  • Yes because react and react-dom versions are different you have to make them same, you can do that by manually remove react and react-dom and reinstall them via npm install react react-dom --save – Santosh Shinde Jul 10 '19 at 07:27
  • actually we are using basic version of reactjs, so now am updating the react to latest version,,,as of now am facing lots errors here,,,, again one more issue i found>>>>InternalPropTypes.js:9 Uncaught TypeError: Cannot read property 'func' of undefined at Object../node_modules/react-router/lib/InternalPropTypes.js – Satish Ameda Jul 10 '19 at 07:34
  • okay may be that is based on your code and version confirmability – Santosh Shinde Jul 10 '19 at 07:35
  • you have to upgrade react-router as well, may be you can post . other issues in different question – Santosh Shinde Jul 10 '19 at 07:38
  • Go through one by one and fix the issue , I hope now you are clear on react and react-dom, and if yes then please accept answer – Santosh Shinde Jul 10 '19 at 07:39
  • actually i want to develop my own site like blog..can you guid me – Satish Ameda Jul 10 '19 at 09:03
  • okay, will guide you, if this answer help u then please accept – Santosh Shinde Jul 25 '19 at 16:36