Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Next.js and React

Module not found: can't resolve 'redux' or 'react-redux'

ErrorModule not found: Error: Can't resolve 'redux'

Short answer

The build cannot find a package that is not installed in this project. Redux Toolkit, React Redux and Redux core are separate packages. Install what you import, and prefer importing from @reduxjs/toolkit, which already re-exports the Redux core.

  • Applies to Redux Toolkit 2, React Redux 9, React 19, Node.js 22
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    See which Redux packages the project really has, and compare with the packages your imports name.

    npm ls redux @reduxjs/toolkit react-redux
    grep -rhn "from 'redux'\|from \"redux\"\|react-redux" src | sort -u
  2. 2Match what you see, then jump to its fix

    1. 1The missing package is react-redux, while @reduxjs/toolkit is installedreact-redux is not installed, because it is not part of Redux ToolkitFix
    2. 2The missing package is redux, with imports such as combineReducers or applyMiddlewareThe code imports from 'redux' but only Redux Toolkit is installedFix
    3. 3Every Redux import fails, often right after cloning a repository or copying a component from another projectNeither package is installed in this projectFix

What does the error look like?

  • Module not found: Error: Can't resolve 'redux'
  • Module not found: Error: Can't resolve 'react-redux'

Cause 1 of 3

react-redux is not installed, because it is not part of Redux Toolkit

1Check

React Redux is the binding between React and Redux, and it is not bundled with Redux Toolkit. It is a separate install.

npm ls react-redux

2Fix

Install it.

npm install react-redux

3Verify

The import of Provider and hooks resolves.

npm run build

Confirmed by redux.js.org

Did this fix it?

Cause 2 of 3

The code imports from 'redux' but only Redux Toolkit is installed

1Check

Redux Toolkit re-exports the Redux core, so most apps never install redux separately. An import from 'redux' needs that package to be a direct dependency of your project.

grep -rn "from 'redux'" src

2Fix

Import the same functions from @reduxjs/toolkit. Use configureStore instead of the old createStore.

import { configureStore, combineReducers } from "@reduxjs/toolkit";

const rootReducer = combineReducers({ todos: todosReducer });
export const store = configureStore({ reducer: rootReducer });

3Verify

The build passes with no import of 'redux' left.

grep -rn "from 'redux'" src; npm run build

Confirmed by redux.js.org

Did this fix it?

Cause 3 of 3

Neither package is installed in this project

1Check

The npm commands install Redux Toolkit and React Redux separately. Nothing in a fresh project provides them.

npm ls @reduxjs/toolkit react-redux

2Fix

Install both, then restart the dev server.

npm install @reduxjs/toolkit react-redux

3Verify

npm ls lists both packages.

npm ls @reduxjs/toolkit react-redux

Confirmed by redux.js.org

Did this fix it?

How do I stop it coming back?

  • Install Redux Toolkit and React Redux together in every new React project.
  • Import Redux core functions from @reduxjs/toolkit in new code.
  • Commit the lock file so every machine installs the same packages.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.