【发布时间】:2018-08-13 12:07:26
【问题描述】:
在我的应用程序中我使用:
- “节点”:“7.2.1”,
- “npm”:“4.4.4”
- “@angular/cli”:“1.4.9”,
- “@angular/core”:“4.4.6”
我在heroku中部署我的应用程序,它构建但是当我运行它时,当我检查它显示的heroku日志时它显示“应用程序错误”
2018-03-05T18:09:46.391200+00:00 app[web.1]: - npm ERR! A complete log of this run can be found in:
2018-03-05T18:09:46.391279+00:00 app[web.1]: - npm ERR! /app/.npm/_logs/2018-03-05T18_09_46_383Z-debug.log
在哪里可以找到这些 .log 文件?
当我运行“node server.js”时,它仍然在等待而不做或显示任何东西
这是我的 server.js 文件
// server.js
const express = require('express');
const app = express();
const path = require('path');
// Run the app by serving the static files
// in the dist directory
app.use(express.static(__dirname + '/dist'));
// Start the app by listening on the default
// Heroku port
app.listen(process.env.PORT || 8080);
app.use(function (req, res, next) {
res.header("Access-Control-Allow-Origin", '*');
res.header("Access-Control-Allow-Credentials", true);
res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS');
res.header("Access-Control-Allow-Headers", 'Origin,X-Requested-With,Content-Type,Accept,content-type,application/json');
next();
});
app.get('/*', function (req, res) {
var origin = req.get('origin');
res.sendFile(path.join(__dirname + '/dist/index.html'));
});
如何解决这个问题?
【问题讨论】:
标签: node.js angular heroku npm