【问题标题】:heroku open - no app specifiedheroku open - 未指定应用程序
【发布时间】:2012-09-10 20:58:35
【问题描述】:

我刚刚使用

创建了一个简单的 Rails 应用程序
rails new myapp

然后使用以下方法创建 heroku 堆栈:

heroku create --stack cedar 

但是当我尝试在 Heroku 上打开应用程序时:

heroku open

我明白了:

 !    No app specified.
 !    Run this command from an app folder or specify which app to use with --app <app name>

还有这个:

$ heroku open --app myapp

给我这个:

 !    App not found

我是否遗漏了一些明显的东西?

【问题讨论】:

  • 您不再需要指定 cedar 堆栈,它现在是默认值
  • 确保向下滚动查看前几个答案。 This one 是最好的。

标签: ruby-on-rails heroku


【解决方案1】:

如果您在 Heroku 上有一个现有的应用程序并且您收到此没有指定应用程序的消息,您可以通过在本地终端上运行它来更正它:

heroku git:remote -a MyHerokuAppName

【讨论】:

  • 这拯救了我的一天。刚刚删除了初始引用并运行了它。谢谢!
  • 这正是我所需要的。我使用来自 git 分支的自动部署。由于一个不相关的原因,我需要形成一个新的回购。这正是我需要解决的问题。此外,当我想从另一台机器(实际上是 cloud9 开发环境)与 heroku 交互时,这个简单的命令让我可以连接并使用 heroku。
【解决方案2】:

Heroku 默认不会使用您的目录名称创建应用程序,所以当您这样做时

heroku create --stack cedar
Creating calm-bayou-3229... done, stack is cedar
http://calm-bayou-3229.herokuapp.com/ | git@heroku.com:calm-bayou-3229.git

它正在创建名为“calm-bayou-3229”的应用程序 你可以这样做

heroku open --app calm-bayou-3229
Opening http://calm-bayou-3229.herokuapp.com/

您可以随时列出您的应用:

heroku apps

【讨论】:

    【解决方案3】:

    解决此问题的另一种方法是广泛了解与 heroku 应用关联的 .git/config 文件正在做什么,并进行必要的调整。

    1.从您的 heroku 项目的根目录打开 .git/config

    您的 git 配置文件可能看起来像这样,尤其是当您在机器上同时使用几个 heroku 帐户时。

    git@heroku.{heroku.account} 出现,而​​不是 git@heroku.com,因为您的 ~/.ssh/config 文件中的配置。应该更新对heroku-app-8396.git 的引用以匹配您的heroku 项目名称。您拥有的每个 heroku 帐户都应该在 ~/.ssh/config 文件中有一个条目。显然,与此 heroku 项目关联的 heroku 帐户应该显示在您的 .git/config 文件中。

    [core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
        ignorecase = true
        precomposeunicode = false
    [remote "origin"]
        fetch = +refs/heads/*:refs/remotes/origin/*
        url = git@heroku.heroku.account:heroku-app-8396.git
    [remote "heroku"]
        fetch = +refs/heads/*:refs/remotes/heroku/*
        url = git@heroku.heroku.account:heroku-app-8396.git
    [branch "master"]
        remote = origin
        merge = refs/heads/master
    [heroku]
      account = heroku.account
    

    2.当我运行git pull heroku master时,一切似乎都运行良好。

    3.当我运行heroku logs时,我收到一条错误消息:

    $ heroku ps
    !    No app specified.
    !    Run this command from an app folder or specify which app to use with --app APP.
    

    为什么?

    据我所知,heroku 命令似乎不知道如何处理{heroku.account} 引用。如果我们将这些引用更改为com(这是您不使用“帐户”heroku 插件时的默认值),heroku 命令再次工作,但现在我们的git 调用表明存在不同问题:

    $ git pull heroku master
    
     !  Your key with fingerprint d6:1b:4c:48:8c:52:d4:d6:f8:32:aa:1a:e7:0e:a2:a1 is not authorized to access smooth-robot-8396.
    
    fatal: Could not read from remote repository.
    
    Please make sure you have the correct access rights
    and the repository exists.
    

    解决此问题的一种方法是为git 定义一个遥控器,为heroku 定义一个遥控器,然后告诉heroku 使用哪个遥控器。

    [core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
        ignorecase = true
        precomposeunicode = false
    [remote "origin"]
        fetch = +refs/heads/*:refs/remotes/origin/*
        url = git@heroku.heroku.account:heroku-app-8396.git
    [remote "heroku"]
        fetch = +refs/heads/*:refs/remotes/heroku/*
        url = git@heroku.heroku.account:heroku-app-8396.git
    [remote "heroku-app"]
        fetch = +refs/heads/*:refs/remotes/heroku/*
        url = git@heroku.com:heroku-app-8396.git
    [branch "master"]
        remote = origin
        merge = refs/heads/master
    [heroku]
        remote = heroku-app
        account = heroku.account
    

    我喜欢在将内容推送到遥控器时显式指定遥控器,因此 heroku 遥控器就是为此而设计的,即使此配置也支持使用默认值(例如 git push)进行推送/拉取。我创建了一个新的远程 'heroku-app' 并添加了remote = heroku-app 来告诉heroku 使用一个在URI 中不包含heroku 帐户的远程。

    现在我可以随意运行githeroku 命令了。

    【讨论】:

    • 你能提供一个你的 ~/.ssh/config 的例子吗?此外,您如何推送到 heroku 的示例也会有所帮助。我尝试按照您的示例进行操作,但无法解决问题。
    • 谢谢您,先生!这是一个惊人的答案!
    【解决方案4】:

    我遇到了同样的问题,我所要做的就是 cd 到项目目录,而不是从项目目录中的模型文件夹运行命令。

    【讨论】:

      【解决方案5】:

      这件疯狂的事对我有用:

      如果您的本地计算机上有应用程序的 git repo 副本,那么 cd 到该位置,就是这样!!

      您将能够使用该应用程序。您可以通过以下命令验证这一点:heroku logs -n 1500

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2019-07-31
        • 1970-01-01
        • 2020-11-06
        • 2021-08-28
        • 1970-01-01
        • 2014-08-26
        • 1970-01-01
        • 2016-05-16
        相关资源
        最近更新 更多