最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

“在Heroku上为应用程序使用多个Buildpack时,没有为此应用程序检测到默认语言”

运维笔记admin10浏览0评论

“在Heroku上为应用程序使用多个Buildpack时,没有为此应用程序检测到默认语言”

“在Heroku上为应用程序使用多个Buildpack时,没有为此应用程序检测到默认语言”

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

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

此外,我已将BUILD_DIR配置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     
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:
remote: !       Push rejected to sheltered-mesa-74202.
remote:
To .git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to '.git'`

谢谢!

回答如下:

在app根目录下创建package.json文件后修复了该问题 -

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

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

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

最好的祝福!

发布评论

评论列表(0)

  1. 暂无评论