reactjs - Module not found: Can't resolve 'react/lib/React' - TagMerge
3Module not found: Can't resolve 'react/lib/React'Module not found: Can't resolve 'react/lib/React'

Module not found: Can't resolve 'react/lib/React'

Asked 1 years ago
3 answers

Your case it is clearly react and react-dom packages incompatibility. Make sure that your react and react-dom packages have the same version to avoid incompatibility.

package.json now:


"react": "^16.2.0",
"react-dom": "^15.6.2", 


package.json with compatible react-dom and react packages:


"react": "^16.2.0",
"react-dom": "^16.2.0", 


Since react-v0.14-beta-1 react and react-dom are separate libraries and you are supposed to use the same version.

For now, please use the same version of react and react-dom in your apps to avoid versioning problems — but we plan to remove this requirement later. (This release includes the old methods in the react package with a deprecation warning, but they’ll be removed completely in 0.15.).

Source: link


This can also happen if you do not specify that .js is a resolvable extension in your Webpack configuration.

When Webpack looks for ./lib/React, it won't look for the ./lib/React.js file if, for example, you only specify .ts as a resolvable extension.


Source: link


This sometimes happens when you update yours react version but not react-dom version.

So, always make sure react and react-dom version should be the same in package.json

Source: link

Recent Questions on reactjs

    Programming Languages