我已经编写了一个Angular应用程序,希望将其部署到Heroku,但是我仍然遇到错误...
当尝试转到将我的应用程序部署到的Web URL时,出现以下错误:
not found
尝试推动时:git heroku push master
我得到:
Push rejected, failed to compile Node.js app.
输入heroku日志-tail时,我得到以下信息
! Couldn't find that app.
但是在运行heroku应用程序时,它显示了我的app-name (eu)
在运行heroku info --app app-name时,我会得到我尝试过的确切网址。
我也尝试过heroku auth:login
,但这无济于事。
我的package-json
如下:
{
"name":"app-name",
"version":"0.0.0",
"engines":{
"node":"10.16.3"
},
"scripts":{
"ng":"ng",
"start":"node server.js",
"heroku-postbuild":"ng build --prod",
"build":"ng build",
"test":"ng test",
"lint":"ng lint",
"e2e":"ng e2e"
},
"private":true,
"dependencies":{
"@angular/animations":"~8.2.11",
"@angular/cdk":"~8.2.3",
"@angular/common":"~8.2.11",
"@angular/compiler":"~8.2.11",
"@angular/cli":"1.4.9",
"@angular/compiler-cli":"^4.4.6",
"@angular/core":"~8.2.11",
"@angular/forms":"~8.2.11",
"@angular/material":"^8.2.3",
"@angular/platform-browser":"~8.2.11",
"@angular/platform-browser-dynamic":"~8.2.11",
"@angular/router":"~8.2.11",
"rxjs":"~6.4.0",
"tslib":"^1.10.0",
"zone.js":"~0.9.1",
"typescript":"~2.3.3"
},
"devDependencies":{
"@angular-devkit/build-angular":"~0.803.13",
"@angular/cli":"~8.3.13",
"@angular/compiler-cli":"~8.2.11",
"@angular/language-service":"~8.2.11",
"@types/jasmine":"~3.3.8",
"@types/jasminewd2":"~2.0.3",
"@types/node":"~8.9.4",
"codelyzer":"^5.0.0",
"enhanced-resolve":"^3.3.0",
"jasmine-core":"~3.4.0",
"jasmine-spec-reporter":"~4.2.1",
"karma":"~4.1.0",
"karma-chrome-launcher":"~2.2.0",
"karma-coverage-istanbul-reporter":"~2.0.1",
"karma-jasmine":"~2.0.1",
"karma-jasmine-html-reporter":"^1.4.0",
"protractor":"~5.4.0",
"ts-node":"~7.0.0",
"tslint":"~5.15.0",
"typescript":"~3.5.3"
}
}
我在这里尝试过有关此主题的所有SO-answer,但没有任何效果。我已经创建了一个server.js
文件,如下所示:
//Install express server
const express = require('express');
const path = require('path');
const app = express();
// Serve only the static files form the dist directory
app.use(express.static(__dirname + '/dist/app-name'));
app.get('/*', function(req,res) {
res.sendFile(path.join(__dirname+'/dist/app-name/index.html'));
});
// Start the app by listening on the default Heroku port
app.listen(process.env.PORT || 8080);
我还尝试取消注释和删除node_modules,但也尝试插入它,但仍然没有变化。
我还仔细检查了节点-v。
我的Procfile看起来像这样:
web: npm start
我在做什么错??
更新(传递文件结构):
更新(更新了我的package-json文件)
我已经对package.json
文件进行了一些小的更新,因此没有将其推送到主文件,但是访问URL时仍然收到“未找到”消息。
日志-tail也显示“找不到该应用” ...非常令人沮丧...
答案 0 :(得分:0)
我相信您会错过拼写应用名称的念头