1

I have tried yarn add react react-dom but still facing these issues.If anyone can help me with this

index.js:1437 D:/ecodocs-admin/node_modules/rc-align/es/Align.js
Module not found: Can't resolve 'react-dom' in 'D:\ecodocs-admin\node_modules\rc-align\es'
console.<computed> @ index.js:1437
index.js:1437 D:/ecodocs-admin/node_modules/rc-animate/es/AnimateChild.js
Module not found: Can't resolve 'react-dom' in 'D:\ecodocs-admin\node_modules\rc-animate\es'
console.<computed> @ index.js:1437
index.js:1437 D:/ecodocs-admin/node_modules/rc-time-picker/es/Select.js
Module not found: Can't resolve 'react-dom' in 'D:\ecodocs-admin\node_modules\rc-time-picker\es'
console.<computed> @ index.js:1437
index.js:1437 D:/ecodocs-admin/node_modules/rc-trigger/es/index.js
Module not found: Can't resolve 'react-dom' in 'D:\ecodocs-admin\node_modules\rc-trigger\es'
console.<computed> @ index.js:1437
index.js:1437 D:/ecodocs-admin/node_modules/rc-trigger/es/Popup.js
Module not found: Can't resolve 'react-dom' in 'D:\ecodocs-admin\node_modules\rc-trigger\es'
console.<computed> @ index.js:1437
index.js:1437 D:/ecodocs-admin/node_modules/rc-util/es/Portal.js
Module not found: Can't resolve 'react-dom' in 'D:\ecodocs-admin\node_modules\rc-util\es'
console.<computed> @ index.js:1437
index.js:1437 D:/ecodocs-admin/node_modules/rc-util/es/ContainerRender.js
Module not found: Can't resolve 'react-dom' in 'D:\ecodocs-admin\node_modules\rc-util\es'
console.<computed> @ index.js:1437
index.js:1437 D:/ecodocs-admin/node_modules/rc-util/es/Dom/addEventListener.js
Module not found: Can't resolve 'react-dom' in 'D:\ecodocs-admin\node_modules\rc-util\es\Dom'

2 Answers 2

4

Use this to install react and react-dom:

yarn add react react-dom

If this not work, you You have to fix the 'externals' configuration in webpack.config :

externals: {
   'react': 'react',
   'react-dom': 'react-dom'
} 
Sign up to request clarification or add additional context in comments.

2 Comments

You just saved me, thank you. But I don't understand, It was working (I had already installed it) It stoped working and it worked again when I added it to externals. Why?
I discovered it stoped working when I added alias: { 'react-dom': '@hot-loader/react-dom' } to the resolve section on my webpack config file. I did it to solve a warning in my browser: react-hot-loader.development.js:2375 React-Hot-Loader: react-🔥-dom patch is not detected. React 16.6+ features may not work
1

I think in many cases people will already have react-dom. If so, based on the comments, I think it is worth checking if you have added @hot-loader/react-dom as an alias, but forgot to install it. In such cases you need to do:

npm install -D @hot-loader/react-dom

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.