"此应用无法检测到默认语言"在Heroku上为应用程序使用多个Buildpack

时间:2017-01-02 21:45:12

标签: node.js heroku typescript buildpack procfile

我向Heroku部署了两个nodejs项目,每个项目位于自己的文件夹中 -
NodejsExpressApp1NodejsConsoleApp1

我已向应用根添加了Procfile文件,其中包含以下内容 -
web: node NodejsExpressApp1/app.js
worker: node NodejsConsoleApp1/app.js

此外,我已将BUILD_DIR config var设置为NodejsExpressApp1文件夹。

本地一切正常。

下面显示了我在部署时获得的内容 -

c:\ExpressMultiProjectApp2>git push heroku master
Counting objects: 1506, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (1401/1401), done.
Writing objects: 100% (1506/1506), 4.85 MiB | 92.00 KiB/s, done.
Total 1506 (delta 269), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote:  !     No default language could be detected for this app.
remote:                         HINT: This occurs when Heroku cannot detect     the buildpack to use for this application automatically.
remote:                         See     https://devcenter.heroku.com/articles/buildpacks
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:
remote: !       Push rejected to sheltered-mesa-74202.
remote:
To https://git.heroku.com/sheltered-mesa-74202.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/sheltered-mesa-74202.git'`

谢谢!

1 个答案:

答案 0 :(得分:0)

在app root中创建package.json文件后修复了该问题 -

{
    "name": "nodejs-express-app1",
    "version": "0.0.0",
    "description": "Multiple Buildpacks App",
    "author": { "name": "SimonBor" },
    "dependencies": {
        "express": "~4.9.0"
    }
}
  

设置变量BUILD_DIR不是必需的步骤。

当然,这不是最佳实践解决方案,但它允许我继续开发 我会更乐意寻求更好的解决方案。

祝你好运!