Can't resolve module 'react-redux' in connected-react-router with react-redux and redux modules installed
Asked Answered
S

1

5

I'm trying to use connected-react-router module.

From the docs, this is my code in the reducer:

import { combineReducers } from 'redux';
import login from './loginReducer';
import { connectRouter } from 'connected-react-router'

export default (history) => combineReducers({
  router: connectRouter(history),
  login
});

I'm getting this error in compilation time:

./node_modules/connected-react-router/esm/ConnectedRouter.js Module not found: Can't resolve 'react-redux' in 'C:\Users\ericn\Documents\ReactJS\test\node_modules\connected-react-router\esm'

I've been looking for this for a while but none seems to have the same problem.

Any thoughts?

Southpaw answered 20/5, 2019 at 21:59 Comment(1)
Where are you importing something from react-redux?Mountford
H
6

I recently experience a similar error. What I realized was that I forgot to add react-redux as a dependency to my project, I only added react.

So confirm that you have react-redux in your package.json and it is installed in your node_modules. If not you can run:

npm install --save react-redux

// or if you are using yarn
yarn add react-redux
Halfhour answered 2/9, 2019 at 22:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.