简体   繁体   English

尝试将电子商务应用程序上传到Heroku时出现redux logger错误

[英]I am getting a redux logger error when I try to upload an ecommerce app to Heroku

I am trying to build an e-commerce store app in React with Moltin JS. 我正在尝试使用Moltin JS在React中构建一个电子商务商店应用程序。 Everytime I try to upload it to Heroku, I get a blank page or an error. 每次尝试将其上传到Heroku时,都会出现空白页或错误。 The error said that it could not resolve "redux-logger". 该错误表明它无法解决“ redux-logger”。 I have tried re-downloading redux logger and also npm install. 我尝试过重新下载redux logger以及npm install。 I still get the same error message. 我仍然收到相同的错误消息。 I've also tried NPM update. 我也尝试过NPM更新。 It works fine when I launch it from my VS Code. 当我从VS Code启动它时,它工作正常。
github docs Heroku Page github docs Heroku页面

 // import the ability to modify browser history within our router import createHistory from 'history/createBrowserHistory'; // import our logger for redux import { createLogger } from 'redux-logger'; // import a library to handle async with redux import thunk from 'redux-thunk'; // import the redux parts needed to start our store import { createStore, applyMiddleware, compose } from 'redux'; // import the middleware for using react router with redux import { routerMiddleware } from 'react-router-redux'; // import the already combined reducers for redux to use import rootReducer from './ducks'; // import moltin API wrapper for use with Redux import * as api from './moltin'; // create and export history for router export const history = createHistory(); // combine the middlewares we're using into a constant so that it can be used by our store const middleware = [thunk.withExtraArgument(api), routerMiddleware(history)]; // declare any enhancers here const enhancers = []; // use Redux devtools if available in development if (process.env.NODE_ENV === 'development') { const devToolsExtension = window.devToolsExtension; if (typeof devToolsExtension === 'function') { enhancers.push(devToolsExtension()); } middleware.push(createLogger()); } // compose our middleware const composedEnhancers = compose(applyMiddleware(...middleware), ...enhancers); // create our redux store using our reducers and our middleware, and export it for use in index.js const store = createStore(rootReducer, composedEnhancers); export default store; 

The trick is that Heroku installs only production dependencies on deployment by default, so the ones that are listed under dependencies key of you package.json by running npm install --production . 诀窍是,Heroku在默认情况下仅在部署时安装生产依赖项,因此,通过运行npm install --productionpackage.jsondependencies项项下列出的dependencies项就可以npm install --production

Move dependencies that are crucial to your app running - like redux-logger - from devDependencies to dependencies and that should solve your problem. devDependencies应用程序运行至关重要的依赖项(例如redux-logger)从devDependencies移至dependencies ,这应该可以解决您的问题。

devDependencies are meant for things that support you in development, but are not required for the production copy of your app to run, like testing modules, for example. devDependencies用于支持开发的事物,但对于运行应用的生产副本不是必需的,例如测试模块。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我正在使用 node js 开发一个应用程序,它在本地运行良好,但在我尝试将其上传到 heroku 时崩溃,它说 cat find dotenv - i am developing an app with node js , it works perfectly locally but crashes anytime i try to upload it to heroku,it says cat find dotenv 当我尝试在 android 上运行 React Native 应用程序时出错 - getting error when i try to run react native app on android 尝试运行此应用时收到setOnClickListener错误 - Getting a setOnClickListener error when I try to run this app 当我在 heroku 中部署我的应用程序时,获取 html 时出错 - Error getting html when I deployed my app in heroku 当我将redux状态与组件状态映射时,出现错误 - when I map my redux state with component state I am getting an error 尝试在Ionic中使用列表时,为什么会出现此JavaScript错误? - Why am I getting this JavaScript error when I try use lists in Ionic? 当我尝试读取 Firebase 上的数据时,出现“未捕获的 ReferenceError:firebase 未定义”错误 - I am getting "Uncaught ReferenceError: firebase is not defined" error when i try to read my datas on Firebase 当我尝试访问$ http var时,为什么会出现此错误? - Why am I getting this error when I try and access the $http var? 我的服务器已启动,但是当我尝试连接它时,出现错误[Node.js] - My Server is up but when I try to connect to it I am getting an error [Node.js] 当我尝试使用英特尔XDK发送Ajax查询时,为什么会出现错误? - Why am I getting an error when I try to send an Ajax query with the Intel XDK?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM