[英]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.