无法将MEAN应用程序部署到Heroku,因为“此应用程序无法检测到默认语言”。

时间:2017-05-31 20:28:13

标签: heroku

我正在尝试将MEAN应用程序部署到Heroku,但由于以下错误而无法推送:

 !     No default language could be detected for this app.
        HINT: This occurs when Heroku cannot detect the buildpack to use for this application automatically.
        See https://devcenter.heroku.com/articles/buildpacks
!     Push failed

我尝试使用最新的节点buildpack版本设置node.js buildpack,但刚收到另一个错误:

failed to detect buildpack

这是我第一次部署到Heroku,所以我在这方面是全新的。

这是我的package.jsons:

服务器

{
  "version": "0.0.0",
  "private": true,
  "scripts": {
    "start": "node ./bin/www"
  },
  "dependencies": {
    "bcrypt": "^1.0.2",
    "body-parser": "^1.16.1",
    "cookie-parser": "^1.4.3",
    "cors": "^2.8.2",
    "debug": "^2.6.3",
    "ejs": "~2.5.5",
    "express": "^4.14.1",
    "jsonwebtoken": "^7.3.0",
    "mongoose": "^4.9.2",
    "morgan": "^1.7.0",
    "multer": "^1.3.0",
    "passport": "^0.3.2",
    "passport-jwt": "^2.2.1",
    "request": "^2.81.0",
    "request-promise": "^4.2.0",
    "serve-favicon": "^2.3.2"
  }
}

客户

{
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/common": "^2.4.0",
    "@angular/compiler": "^2.4.0",
    "@angular/core": "^2.4.0",
    "@angular/forms": "^2.4.0",
    "@angular/http": "^2.4.0",
    "@angular/platform-browser": "^2.4.0",
    "@angular/platform-browser-dynamic": "^2.4.0",
    "@angular/router": "^3.4.0",
    "@types/googlemaps": "^3.26.8",
    "@types/jquery": "^2.0.43",
    "@types/lodash": "^4.14.62",
    "@types/underscore": "^1.8.0",
    "amcharts3-angular2": "github:amcharts/amcharts3-angular2",
    "angular2-google-maps": "^0.17.0",
    "core-js": "^2.4.1",
    "dotenv": "^4.0.0",
    "jquery": "^3.2.1",
    "lodash": "^4.17.4",
    "ng2-google-charts": "^2.1.0",
    "rxjs": "^5.1.0",
    "tslint": "^4.4.2",
    "typescript": "^2.0.10",
    "underscore": "^1.8.3",
    "zone.js": "^0.7.6"
  },
  "devDependencies": {
    "@angular/cli": "1.0.0-rc.0",
    "@angular/compiler-cli": "^2.4.0",
    "@types/jasmine": "2.5.38",
    "@types/node": "~6.0.60",
    "codelyzer": "~2.0.0",
    "jasmine-core": "~2.5.2",
    "jasmine-spec-reporter": "~3.2.0",
    "karma": "~1.4.1",
    "karma-chrome-launcher": "~2.0.0",
    "karma-cli": "~1.0.1",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "karma-coverage-istanbul-reporter": "^0.2.0",
    "protractor": "~5.1.0",
    "ts-node": "~2.0.0",
    "tslint": "~4.4.2",
    "typescript": "~2.0.0"
  }
}

为什么Heroku没有检测到Node?

2 个答案:

答案 0 :(得分:0)

根据Heroku documentation

  

要确定如何启动您的应用,Heroku首先会查找Procfile。   如果Node.js应用程序不存在Procfile,我们将尝试启动   通过package.json中的启动脚本进行默认Web处理。

所以你不需要设置构建包。

答案 1 :(得分:0)

我有两个package.jsons,一个用于客户端,一个用于服务器。我需要将我的服务器依赖项放入根文件夹(它们分别嵌套在客户端和服务器文件夹中)。将它移动到root中使它可以被heroku检测到。当然,现在我有一个新的错误。 :)