在Heroku git:clone之后创建的子目录中未安装Heroku CLI

时间:2018-09-19 15:40:25

标签: git heroku ruby-on-rails-3.2 heroku-cli

我试图在新机器上创建开发环境,并陷入与heroku的连接。我下载并安装了cli,heroku -v显示我具有最新版本。我的文件夹结构是Users / tombrown / projects。当我在项目下手动创建新目录时,新的子目录也已安装了cli,但是当我git clone或heroku git:clone时,新的子目录表明未安装cli。

Thomass-MacBook:projects tombrown$ heroku -v
heroku/7.16.0 darwin-x64 node-v10.10.0
Thomass-MacBook:projects tombrown$ heroku git:clone -a livebytransit
Cloning into 'livebytransit'...
remote: Counting objects: 4814, done.
remote: Compressing objects: 100% (1579/1579), done.
remote: Total 4814 (delta 3276), reused 4564 (delta 3087)
Receiving objects: 100% (4814/4814), 15.68 MiB | 5.75 MiB/s, done.
Resolving deltas: 100% (3276/3276), done.
Thomass-MacBook:projects tombrown$ cd livebytransit
Thomass-MacBook:livebytransit tombrown$ heroku -v
Install the Heroku CLI from https://cli.heroku.com
Thomass-MacBook:livebytransit tombrown$ rm -rf livebytransit
Thomass-MacBook:livebytransit tombrown$ cd ..
Thomass-MacBook:projects tombrown$ ls
livebytransit
Thomass-MacBook:projects tombrown$ rm -rf livebytransit
Thomass-MacBook:projects tombrown$ ls
Thomass-MacBook:projects tombrown$ git clone https://github.com/tom-brown/LiveByTransit.git
Cloning into 'LiveByTransit'...
remote: Counting objects: 4820, done.
remote: Compressing objects: 100% (59/59), done.
remote: Total 4820 (delta 38), reused 50 (delta 23), pack-reused 4737
Receiving objects: 100% (4820/4820), 15.35 MiB | 6.14 MiB/s, done.
Resolving deltas: 100% (3285/3285), done.
Thomass-MacBook:projects tombrown$ cd LiveByTransit
Thomass-MacBook:LiveByTransit tombrown$ git init
Reinitialized existing Git repository in /Users/tombrown/projects/LiveByTransit/.git/
Thomass-MacBook:LiveByTransit tombrown$ git add .
Thomass-MacBook:LiveByTransit tombrown$ git commit -m "kind of first commit"
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
Thomass-MacBook:LiveByTransit tombrown$ heroku git:remote -a livebytransit
Install the Heroku CLI from https://cli.heroku.com

有人遇到这个问题吗?我在heroku帮助或stackoverflow中没有看到任何类似的东西。

根据下面第一条评论中的建议,which herokutype heroku的输出都提供了很大的提示。路径有问题。

Thomass-MacBook:LiveByTransit tombrown$ which heroku
/Users/tombrown/.rvm/gems/ruby-2.3.1/bin/heroku
Thomass-MacBook:LiveByTransit tombrown$ type heroku
heroku is /Users/tombrown/.rvm/gems/ruby-2.3.1/bin/heroku
Thomass-MacBook:LiveByTransit tombrown$ cd ..
Thomass-MacBook:projects tombrown$ which heroku
/usr/local/bin/heroku
Thomass-MacBook:projects tombrown$ type heroku
heroku is /usr/local/bin/heroku
Thomass-MacBook:projects tombrown$

1 个答案:

答案 0 :(得分:1)

看起来您在Ruby 2.3.1 RVM gemset中安装了legacy heroku Gem。当该Ruby环境处于活动状态时,这将隐藏系统安装的modern heroku CLI

~/.rvm/gems/ruby-2.3.1环境处于活动状态时,通过运行gem uninstall heroku删除旧版Gem。