首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
社区首页 >问答首页 >在Heroku同构应用上构建错误

在Heroku同构应用上构建错误
EN

Stack Overflow用户
提问于 2016-11-02 17:44:56
回答 1查看 59关注 0票数 0

当我尝试在Heroku上部署我的应用程序时,我得到了以下错误:

代码语言:javascript
运行
AI代码解释
复制
Cannot GET / 
NOT FOUND - The server has not found anything matching the requested URI (Uniform Resource Identifier).


Server is being run outside of live development mode, meaning it will only serve the compiled application bundle in ~/dist. Generally you do not need an application server for this and can instead use a web server such as nginx to serve your static files. See the "deployment" section in the README for more information on deployment strategies.

我知道我应该“实时”运行它,而不是从本地主机运行,因此我通过CLI设置了以下设置:

代码语言:javascript
运行
AI代码解释
复制
heroku config:set NODE_ENV=production
heroku config:set NODE_PATH=./src
heroku config:set NPM_CONFIG_PRODUCTION=false

我还应该检查什么。这个应用程序是这个锅炉的克隆:https://github.com/davezuko/react-redux-starter-kit

我的Heroku链接是:https://hidden-temple-43853.herokuapp.com/

EN

回答 1

Stack Overflow用户

发布于 2016-11-18 17:05:35

假设您不使用Procfile来告诉Heroku如何启动您的应用程序,那么可以使用package.json will be usednpm start脚本。

在部署到Heroku之前,您是否正在使用NODE_ENV=production运行npm run deploy

在部署到Heroku时建议修复的Have a look at this issue (复制如下)。

代码语言:javascript
运行
AI代码解释
复制
// ...
// ------------------------------------
// Apply Webpack HMR Middleware
// ------------------------------------
if (config.env === 'development') {
  const webpackDevMiddleware = require('./middleware/webpack-dev').default
  const webpackHMRMiddleware = require('./middleware/webpack-hmr').default
  const compiler = webpack(webpackConfig)

  // Enable webpack-dev and webpack-hot middleware
  const { publicPath } = webpackConfig.output

  app.use(webpackDevMiddleware(compiler, publicPath))
  app.use(webpackHMRMiddleware(compiler))

// ...
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/40386428

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档
查看详情【社区公告】 技术创作特训营有奖征文