Reputation: 91
ERROR:
Error: Cannot find module 'redux'
at Function.Module._resolveFilename (module.js:555:15)
at Function.Module._load (module.js:482:25)
at Module.require (module.js:604:17)
at require (internal/module.js:11:18)
at Object. (C:\dev\Django code\portfolio_web\stats_frontend\node_modules\react- redux\lib\connect\mapDispatchToProps.js:8:14)
at Module._compile (module.js:660:30)
at Module._extensions..js (module.js:671:10)
at Object.require.extensions.(anonymous function) [as .js] (C:\dev\Django code\portfolio_web\stats_frontend\node_modules\babel- register\lib\node.js:152:7) at Module.load (module.js:573:32)
at tryModuleLoad (module.js:513:12)
The file where I import react-redux
is reduxStore.js
:
import {createStore} from 'react-redux;
//There is nothing else. The function being imported doesn't change anything`
I'm running the file with babel-node, or with webpack-cli (which is using babel to transpile ES2015
. In both cases I get the same error.
Tracing the error I can open the source (
...\stats_frontend\node_modules\react-redux\lib\connect\mapDispatchToProps.js
of the error (its from official react-redux
dist).
Line 8 (which causes the error) I can see a commonJS import:
var _redux = require('redux');
Upon further inspection I can see that the node search algorithm will not find 'redux'
because no such file exists in ./node_modules/react-redux/
or in ./node_modules/
I have installed and updated my react-redux
installation with node install --save-dev react-redux
with no errors.
I was hoping someone can provide insight on why the error occurs and how to fix it
Upvotes: 0
Views: 1601
Reputation: 655
You are importing createStore from wrong library. import it from redux
import { createStore } from 'redux';
Upvotes: 1