In order to solve the error "Module not found: Error: Can't resolve 'react-redux"
Compiled with problems:X
ERROR in ./src/App.js 12:0-39
Module not found: Error: Can't resolve 'react-redux'
The first thing you need to ensure is that you have installed the redux package.
open the terminal at the root of your project and use one of these commands:
Using Npm
npm install react-redux
Using Yarn
yarn add react-redux
If that did not work, delete node_modules directory and delete package-lock.json file, both of which should be located at the root of your project.
Then run command below:
npm install
Now try to install redux again.
If that still does not resolve the issue, check to ensure that the package is included in the package.json file which should be located at the root of your project.
"dependencies": {
"react": "^18.1.0",
"react-dom": "^18.1.0",
"react-redux": "^8.0.2",
},
if it is not in the dependencies object, you can manually add it in, then run below command again:
npm install
or install the latest version of redux
npm install react-redux@latest