当我尝试在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.
我知道我应该“实时”运行它,而不是从本地主机运行,因此我通过CLI设置了以下设置:
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/
发布于 2016-11-18 17:05:35
假设您不使用Procfile来告诉Heroku如何启动您的应用程序,那么可以使用package.json
will be used的npm start
脚本。
在部署到Heroku之前,您是否正在使用NODE_ENV=production
运行npm run deploy
?
在部署到Heroku时建议修复的Have a look at this issue (复制如下)。
// ...
// ------------------------------------
// 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))
// ...
https://stackoverflow.com/questions/40386428
复制相似问题