![](/img/trans.png)
[英]Heroku : Error: ENOENT: no such file or directory, open '/app/build/index.html'?
[英]Angular (Ionic) app build on Heroku - Error: ENOENT
我正在嘗試將我的 Angular 應用程序部署到 Heroku,但在 Heroku 控制台中仍然出現錯誤:
Error: ENOENT: no such file or directory, stat '/app/dist/index.html'
這是我的server.js
文件
const express = require("express");
const path = require("path");
const app = express();
app.use(express.static(__dirname + "/dist"));
app.get("/*", function(req, res) {
res.sendFile(path.join(__dirname, "dist", "index.html"));
});
app.listen(process.env.PORT || 8080);
我也嘗試使用appName
而不是dist
,但沒有奏效。
我還從.gitignore
中刪除了/dist
我在 package.json 中設置"postinstall": "ng build --aot --prod"
package.json
"start": "node server.js"
腳本
問題出在文件名上 - Ionic 構建文件稱為 /www,而不是 /dist。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.