[英]Error Building on Heroku - Isomorphic App
尝试在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/
假设您没有使用Procfile告诉Heroku如何启动您的应用程序, 则将使用 package.json
的npm start
脚本。
在部署到Heroku之前,是否要使用NODE_ENV=production
运行npm run deploy
?
请看一下建议将其部署到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.