Search code examples
reactjsreact-nativereduxreact-redux

Module not found: Can't resolve 'react'


I'm trying to connect my Redux store to my React project, but I keep getting this error:

../node_modules/react-redux/es/components/Provider.js Module not found: Can't resolve 'react' in 'C:\Users.\Documents..\node_modules\react-redux\es\components'

I've installed both react-redux and redux (I believe react-redux has some dependencies on redux)

import { Provider} from 'react-redux';

This is what is giving the error.

Any suggestions on what I could do?


Solution

  • This could be caused by your node_modules

    First delete your node_modules, package-lock.json, and yarn.lock then install all dependencies again

    like rm -rf node_modules package-lock.json yarn.lock

    then run

    npm install or yarn install