Eric Nordelo Galiano
Eric Nordelo Galiano

Reputation: 455

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

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?

Upvotes: 5

Views: 6539

Answers (1)

perfectmak
perfectmak

Reputation: 61

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

Upvotes: 6

Related Questions