运行命令> git push heroku master 由于找不到错误,我无法启动应用程序。
at=info method=GET path="/" host=winpi.herokuapp.com request_id=26ef09fe-0713-4290-b3d7-75ae390decfc fwd="87.196.76.163" dyno=web.1 connect=0ms service=37ms status=404 bytes=380 protocol=https
2017-11-18T01:07:34.416342+00:00 app[web.1]: Error: ENOENT: no such file or directory, stat '/dist/index.html'
所以这是我的本地文件结构:
-rw-r--r-- 1 brunolopes staff 15 Nov 14 23:06 Procfile
-rw-r--r-- 1 brunolopes staff 1555 Nov 12 17:21 angular-cli.json
-rw-r--r-- 1 brunolopes staff 501 Nov 18 01:07 app.js
-rw-r--r-- 1 brunolopes staff 956 Oct 4 00:41 cert.pem
-rw-r--r-- 1 brunolopes staff 769 Oct 3 19:12 csr.pem
drwxr-xr-x 26 brunolopes staff 884 Nov 16 07:51 dist
drwxr-xr-x 5 brunolopes staff 170 Sep 26 00:56 e2e
-rw-r--r-- 1 brunolopes staff 923 Sep 26 00:56 karma.conf.js
-rw-r--r-- 1 brunolopes staff 887 Oct 3 19:11 key.pem
drwxr-xr-x 828 brunolopes staff 28152 Nov 13 23:33 node_modules
-rw-r--r-- 1 brunolopes staff 2733 Nov 15 20:57 npm-debug.log
-rw-r--r-- 1 brunolopes staff 327190 Sep 26 01:21 package-lock.json
-rw-r--r-- 1 brunolopes staff 1772 Nov 17 10:54 package.json
-rw-r--r-- 1 brunolopes staff 2616 Sep 18 19:21 pom.xml
-rw-r--r-- 1 brunolopes staff 722 Sep 26 00:56 protractor.conf.js
-rw-r--r-- 1 brunolopes staff 72 Sep 17 23:34 proxy.conf.json
drwxr-xr-x 14 brunolopes staff 476 Nov 13 19:21 src
drwxr-xr-x 4 brunolopes staff 136 Nov 13 23:29 target
-rw-r--r-- 1 brunolopes staff 363 Sep 26 00:56 tsconfig.json
-rw-r--r-- 1 brunolopes staff 2968 Sep 26 00:56 tslint.json
dist文件夹包含index.html:
-rw-r--r-- 1 brunolopes staff 3585 Nov 16 07:51 index.html
然后是app.js文件:
let express = require('express');
var app = express();
let server = require('http').Server(app);
var path = require('path');
var rootPath = path.normalize(__dirname + '/');
app.use(express.static(rootPath + '/dist'));
app.get('*', function (req, res) {
const index = path.join(__dirname,'../dist/index.html');
res.sendFile(index);
});
var webapp = app.listen(process.env.PORT || 8080, function () {
var port = webapp.address().port;
console.log("App now running on port", port);
});
和删除/ dist文件夹后的.gitignore文件:
See http://help.github.com/ignore-files/ for more about ignoring
files.
# compiled output
/tmp
/out-tsc
# dependencies
/node_modules
# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
testem.log
/typings
# e2e
/e2e/*.js
/e2e/*.map
# System Files
.DS_Store
Thumbs.db
任何线索都没有在dist上找到index.html,即使从.gitignore中删除了dist文件夹,它也没有被推送到heroku,我可以看到它在运行git commit时被添加但是然后没有推送运行git push heroku master,.gitignore远程正常,使用正确的内容更新,在这种情况下没有dist文件夹。
这里缺少什么点?
谢谢