Search code examples
react-nativereact-reduxredux-toolkit

redux-toolkit got error after install react-redux


First, I installed @reduxjs/toolkit and redux

After that, when I continue to install react-redux, I got this error after building the app:

error: Error: Unable to resolve module ../../../../src/redux from C:\Development_Projects\atlas\node_modules\@reduxjs\toolkit\dist\redux-toolkit.cjs.production.min.js:

None of these files exist:
  * src\redux(.native|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)
  * src\redux\index(.native|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)

Is this some kind of library bug? This is a new project starting from scratch and I just setting up the library.


Solution

  • The problem was that I named a folder "redux", so somehow the compiler take that folder by mistake, all I need to do is rename the folder, clear Metro cache, rebuild the app again and it's fine.