简体   繁体   中英

Error Building on Heroku - Isomorphic App

When trying to deploy my app on Heroku, I'm getting the following errors:

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:

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

My Heroku link is: 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.

Are you running the npm run deploy with NODE_ENV=production before deploying to Heroku?

Have a look at this issue where a fix was suggessted on deploying to Heroku (copied below).

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

// ...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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