无法在heroku上推送node.js应用程序

时间:2016-09-22 16:15:20

标签: javascript node.js git heroku

我尝试在heroku上推送我的node.js应用程序但是。此应用无法检测到默认语言。我甚至尝试过heroku buildpacks:设置heroku / nodejs。但还是无法推动。

 Counting objects: 31, done.
    Delta compression using up to 4 threads.
    Compressing objects: 100% (24/24), done.
    Writing objects: 100% (31/31), 5.37 KiB | 0 bytes/s, done.
    Total 31 (delta 3), 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 radiant-cliffs-91678.
    remote: 
    To https://git.heroku.com/radiant-cliffs-91678.git
     ! [remote rejected] master -> master (pre-receive hook declined)
    error: failed to push some refs to 'https://git.heroku.com/radiant-cliffs-91678.git'

2 个答案:

答案 0 :(得分:5)

根据您的日志,看起来Heroku无法检测到您应用的语言。

对于Node.js,您需要在项目的根目录中创建package.json文件(使用类似npm init的内容),或者您可以在根目录中创建Procfile您的项目以指定您的语言:

web: node index.js

答案 1 :(得分:-3)

转到命令行并运行以下命令:

heroku buildpacks:set -a app_name heroku/node