获取(0 redux.applymiddleware)不是函数错误

时间:2018-06-27 11:42:42

标签: node.js reactjs redux react-redux redux-thunk

我的react-redux应用出现错误(0,redux.applymiddleware)

这是我的商店部分代码:

    import {c[enter image description here][2]reateStore, applyMiddleware} from 'redux';
    import thunk from 'redux-thunk';
    import imReducer from '../reducer';


    import {ENQUIRY_FOLDER_NAMES} from '../constants/constants';


    const logger = (store)=>(next)=>(action)=>{
    if(typeof action !== "function"){
    }
    return next(action);

    }

    if(typeof(Storage) !== "undefined" && localStorage.getItem('id_token') != ''){

    let initialState = {hasMoreFolders:true,isFetchingFolders:false,prodError:false,enqError:false,requesting:true,enquiries:[],authenticated:false,hasMoreItems:true,isFetching:false,updateMessage:'',myProducts:[],isFetchingMyProducts:false,hasMoreMyProducts:true,myWFOBProducts:[],user:[],prevPath:'',start:0,end:20,returnCC: "IN"};
    }else{
    let initialState = {hasMoreFolders:true,isFetchingFolders:false,prodError:false,enqError:false,requesting:true,enquiries:[],authenticated:false,hasMoreItems:true,isFetching:false,updateMessage:'',myProducts:[],isFetchingMyProducts:false,hasMoreMyProducts:true,myWFOBProducts:[],user:[],prevPath:'',start:0,end:20,returnCC: "IN"};
    }

   let initialState = {hasMoreFolders:true,isFetchingFolders:false,prodError:false,authenticated:false,enquiries:[],hasMoreItems:true,isFetching:false,updateMessage:'',myProducts:[],wfobpCount:false,isFetchingMyProducts:false,hasMoreMyProducts:true,myWFOBProducts:[],folders:ENQUIRY_FOLDER_NAMES,prodDetail:[],catData :{},isUploadingImage:false,imageData:{},imageUploaded:false,updatedItemId:false,itemUpdatedMyProduct:[],start:0,end:20,pageType:'All',enqType:'A',folderValue:1,buyleads:[],hasMoreBuyleads:true,isFetchingBuyleads:true,offerData:[],purchaseCreditResult:[],orderId:[],loc_count:[],listing_val:{},blstart:1,blend:10,lead_purchase:[],blPageType:0,offerDataExists:false,expired:false,suggested:[],requesting:true,enqError:false,returnCC: "IN",success:false,purchase:false,decodePackageBuyResp:'',blpopState:true,refresh:false,expiredShortlist:0,searchlist:[],searchstart:0,pbrData:{},objBl:{},searchData:{},searchend:13,tabValue:"",isFetchingSearch:false,isloadedSearch:false,hasMoreSearch:true,get_products:[],searchsuggested:[],get_recentsearches: [], get_recentrelatedmcats: [], premium_brands : [],products_loading : false,searches_loading: false, results_loading: false, country_ip:[] , country_iso:[], country_name:'IN', searcherror:false, getbrands:true, get_latestenqbls:'', updatebrands : false, updatecats : false, updateprods : false} 




    if(typeof window !== "undefined"){
       var stateData = window.stateData;
       initialState = Object.assign({}, initialState, stateData);
    }
    const imStore = createStore(
        imReducer,
        initialState,
        applyMiddleware(logger, thunk)
    );

    export default imStore;

这是我用作依赖项的软件包

"dependencies": {
"babel-core": "^6.24.0",
"babel-loader": "^6.4.1",
"babel-polyfill": "^6.26.0",
"babel-preset-es2015": "^6.24.0",
"babel-preset-react": "^6.23.0",
"babel-register": "^6.24.1",
"bcrypt": "^1.0.2",
"body-parser": "^1.17.1",
"compression": "^1.7.1",
"constants": "0.0.2",
"cookie-parser": "^1.4.3",
"cors": "^2.8.3",
"css-loader": "^0.23.1",
"debug": "^2.6.6",
"encoding": "^0.1.12",
"express": "^4.15.2",
"extract-text-webpack-plugin": "^2.1.0",
"file-loader": "^0.10.1",
"formidable": "^1.1.1",
"geoip-lite": "^1.2.1",
"http": "0.0.0",
"import-export": "^1.0.1",
"inherits": "^2.0.3",
"ipaddr.js": "^1.3.0",
"isomorphic-fetch": "^2.2.1",
"json-loader": "^0.5.7",
"loader-utils": "^1.1.0",
"mime": "^1.3.6",
"next": "^2.3.1",
"node-env-file": "^0.1.8",
"node-fetch": "^1.6.3",
"node-uuid": "^1.4.8",
"path": "^0.12.7",
"preact": "^8.2.6",
"preact-compat": "^3.17.0",
"qs": "^6.4.0",
"react": "^15.5.4",
"react-addons-update": "^15.5.2",
"react-dom": "^15.5.4",
"react-helmet": "^5.2.0",
"react-hot-loader": "^1.3.1",
"react-html-parser": "^1.0.3",
"react-redux": "^5.0.4",
"react-router": "^3.0.5",
"react-scripts": "^0.7.0",
"react-toolbox": "^2.0.0-beta.7",
"react-virtualized": "^9.7.5",
"redux": "^3.6.0",
"redux-infinite-scroll": "^1.0.9",
"redux-thunk": "^2.2.0",
"register": "0.0.0",
"request": "^2.81.0",
"request-ip": "^2.0.2",
"serviceworker-webpack-plugin": "^0.2.1",
"style-loader": "^0.13.2",
"sw-precache-webpack-plugin": "^0.9.1",
"uglifyjs-webpack-plugin": "^0.4.6",
"url-loader": "^0.5.8",
"uuid": "^3.0.1",
"webpack": "^2.5.1",
"webpack-dev-middleware": "^1.10.2",
"webpack-hot-middleware": "^2.18.0"}

此代码随机抛出上述错误(0 redux.applymiddleware) 错误是间歇性发生的,并且在发生错误时,它会阻止进一步执行代码!

无法包含完整的reducer文件,因此添加了屏幕截图!

Reducer File

Reducer File contd....

1 个答案:

答案 0 :(得分:0)

显然,这是服务器问题!其他一切都很好