简体   繁体   English

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

[英]Error Building on Heroku - Isomorphic App

When trying to deploy my app on Heroku, I'm getting the following errors: 尝试在Heroku上部署我的应用程序时,出现以下错误:

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.

I understand that I should be running it "live", rather than from the localhost, so I set the following settings via the CLI: 我知道我应该“实时”运行它,而不是从本地主机运行它,所以我通过CLI设置了以下设置:

heroku config:set NODE_ENV=production
heroku config:set NODE_PATH=./src
heroku config:set NPM_CONFIG_PRODUCTION=false

What else should I check for. 我还应该检查什么。 The app is a clone of this boiler: https://github.com/davezuko/react-redux-starter-kit 该应用程序是此锅炉的克隆: https : //github.com/davezuko/react-redux-starter-kit

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

Assuming you don't use a Procfile to tell Heroku how to launch your app, the npm start script of package.json will be used instead. 假设您没有使用Procfile告诉Heroku如何启动您的应用程序, 则将使用 package.jsonnpm start脚本。

Are you running the npm run deploy with NODE_ENV=production before deploying to Heroku? 在部署到Heroku之前,是否要使用NODE_ENV=production运行npm run deploy

Have a look at this issue where a fix was suggessted on deploying to Heroku (copied below). 请看一下建议将其部署到Heroku的问题(复制如下)。

// ...
// ------------------------------------
// 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))

// ...

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM