Heroku re-install "Directory not empty" error - ruby-on-rails

I have a simple rails app that runs (localhost:3000) when rails server is launched, but refuses to run when heroku open is launched. I have attempted various fixes following different pointers here (and elsewhere) and repeatedly updated and installed bundler. Today, when I tried heroku open, I got this:
Install the Heroku CLI from https://cli.heroku.com.
So I did (even though I thought Heroku CLI had been installed). Weird thing is: I couldn't find the installed Heroku CLI app on my computer. To make sure Heroku CLI had been installed properly, I tried
brew install heroku/brew/heroku
as instructed on Heroku's website. Sure enough, I got this message:
Warning: heroku/brew/heroku 7.7.8 is already installed and up-to-date
To reinstall 7.7.8, run 'brew reinstall heroku'
When I tried brew reinstall heroku, I got this message:
Error: The brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/heroku
Target /usr/local/bin/heroku
already exists. You may want to remove it:
rm '/usr/local/bin/heroku'
To force the link and overwrite all conflicting files:
brew link --overwrite heroku
To list all files that would be deleted:
brew link --overwrite --dry-run heroku
Possible conflicting files are:
/usr/local/bin/heroku -> /usr/local/lib/heroku/bin/heroku
....
==> Summary
🍺 /usr/local/Cellar/heroku/7.7.8: 17,135 files, 45.5MB, built in 1 minute 9 seconds
Error: Directory not empty # dir_s_rmdir - /usr/local/Cellar/heroku/7.7.8.reinstall
What does this even mean? Should I do it without messing up other apps? I am just beginning to understand there are differences among local/global/root installations, so could use some help figuring out this one. Thanks in advance!

Related

Are different Heroku installations conflicting?

I have spent many hours trying to understand the implications of local installation vs global (root?) installation, but couldn't grasp enough to even formulate a question. This issue (below) with Heroku is a part of that puzzle.
Heroku had been installed-and worked with some simple rails apps. But out of the blue, I began to get an error message that I should install Heroku CLI. Thinking perhaps I had messed things up, I went ahead and used Brew to install Heroku this time (brew install heroku/brew/heroku) Though the installation was successful, I continued to get the same error message about installing Heroku CLI.
Today, I started another rails app (rails new MyApp, got the same error message Install the Heroku CLI from https://cli.heroku.com, tried brew install heroku/brew/heroku yet again, and here's a new message:
Warning: heroku/brew/heroku 7.7.8 is already installed, it's just not linked
You can use `brew link heroku` to link this version.
When I did brew link heroku , I got this:
Linking /usr/local/Cellar/heroku/7.7.8...
Error: Could not symlink bin/heroku
Target /usr/local/bin/heroku
already exists. You may want to remove it:
rm '/usr/local/bin/heroku'
To force the link and overwrite all conflicting files:
brew link --overwrite heroku
To list all files that would be deleted:
brew link --overwrite --dry-run heroku
and brew link --overwrite --dry-run heroku led to:
Would remove:
/usr/local/bin/heroku -> /usr/local/lib/heroku/bin/heroku
Am I correct to assume that I am dealing with conflicting installations?
How do I resolve the current Heroku issue--let it remove duplicate files? What does that mean? (And which gets removed: /usr/local/bin/heroku or /usr/local/lib/heroku/bin/heroku ?
I believe I have similar issues related to ruby gem installations. I'd appreciate some pointers on understanding the fundamental issue of global vs local (vs individual app installations?), specifically related to ruby, rails and ruby gems.

Issues updating Heroku to a newer version on Cloud9 IDE

I've been having trouble trying to update to the latest version of Heroku on Cloud9 as you can see here:
~/workspace/hello_app (master): $ heroku version
heroku-toolbelt/3.31.3 (x86_64-linux) ruby/2.1.5
You have no installed plugins.
WARNING: Toolbelt v3.37.6 update available.
But when I try to update it, this is what I got:
~/workspace/hello_app (master):$ heroku update
! To update this version of the Heroku client please use
! `apt-get install heroku-toolbelt`
Then I tried typing in 'apt-get install heroku-toolbelt' into my terminal and this was the result:
~/workspace/hello_app (master): $ apt-get install heroku-toolbelt
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
I have also tried to install Heroku Toolbelt using https://toolbelt.heroku.com/ , but I still seem to get the same warning that you see with the first code above telling me that I need to update it to v 3.37.6 . I'm sorry for this newbie mistake, but is there anyone out there that can help me resolve this little issue, please? Thanks.
You should use
sudo apt-get install heroku-toolbelt
In the new version of Cloud9 we don't have support for deployment from the UI yet unfortunately.
You can manually install various command-line tools into your workspace and deploy using the command line. It should go without saying that this is for developers that aren't afraid of the command line.
https://docs.c9.io/v1.0/docs/deploying-via-cli
I got the same problem and it got resolved by this..
$ heroku login
$ heroku version
heroku-toolbelt/3.37.6 (x86_64-linux) ruby/2.2.1
You have no installed plugins.
$ heroku plugins:update
$ heroku plugins:install
Installing Heroku Toolbelt v4... done
Setting up node-v4.1.2... done
Installing core plugins heroku-cli-addons, heroku-apps, heroku-fork, heroku-git, heroku-local, heroku-run, heroku-status... done
▸ Missing argument: NAME
$ heroku version
heroku-toolbelt/3.37.6 (x86_64-linux) ruby/2.2.1
heroku-cli/4.25.2-beb750a (amd64-linux) go1.5.1
=== Installed Plugins
heroku-apps#0.3.0
heroku-cli-addons#0.0.2
heroku-fork#4.0.0
heroku-git#2.4.1
heroku-local#4.1.4
heroku-run#2.7.1
heroku-status#1.2.2

Gem installed but 'command not found'

I've installed a Ruby gem called wordmove to work with pushing and pulling my Wordpress sites but when I run wordmove commands I get the error command not found. I've done some research and I haven't come up with much, I've come to the conclusion based on what I've seen that my Ruby install is messed up.
I ran echo "$PATH" from my root and it returned the following:
/Library/Frameworks/Python.framework/Versions/3.4/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/Users/brettgolding/.rbenv/shims:/usr/local/bin:/user/local/sbin:/usr/local/mysql/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/MacGPG2/bin
I am a noob with the terminal so have no idea how to clean this mess up.
So you're working with rbenv. According to its README, you should run rbenv rehash after installing any gems that have an executable command. Also, run it anytime you install a new Ruby version.

Can't get Homebrew and git to work the way I want them to

First off, I'm sorry for any silly mistakes on my part. I'm just starting with OneMonthRails, and this is all very new to me. My problem is with Homebrew and git. I'm told that my problem has to do with environmental variables, and I've done enough research to be confident this is correct. Ok, here's the details:
I've tried to install Homebrew, but ran into a snag with Xcode being absent. Was running OSX 10.6.8, and had to upgrade to at least 10.7.x to install the latest Xcode. I upgraded to OSX 10.8.4 and installed Xcode and reran the following line
$ ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
I get the following script:
==> Installation successful!
You should run `brew doctor' *before* you install anything.
Now type: brew help
I am installing Homebrew so that I can install ImageMagick in order to run the Paperclip gem, so I take the advice of my Terminal about running $ brew doctor.
$ brew doctor
produces the line
Warning: Experimental support for using Xcode without the "Command Line Tools".
You have only installed Xcode. If stuff is not building, try installing the
"Command Line Tools" package provided by Apple.
Warning: Broken symlinks were found. Remove them with `brew prune`:
///long list of broken symlinks///
Warning: An outdated version of Git was detected in your PATH.
Git 1.7.10 or newer is required to perform checkouts over HTTPS from GitHub.
Please upgrade: brew upgrade git
I want to know what my git version is so I run the following script:
$ git --version
and that produces the following line:
git version 1.7.9.6
I identify where my git is located:
$ which git
and that brings:
/opt/sm/pkg/active/bin/git
After some more research, I find out that I can upgrade my git with the following script:
$ brew install git
The final line of the resulting script is a warning:
Warning: This keg was marked linked already, continuing anyway
==> Summary
🍺 /usr/local/Cellar/git/1.8.3.2: 1325 files, 28M, built in 45 seconds
I verify my git upgrade
$ git --version
git version 1.7.9.6
sudo think...maybe I need to run upgrade instead of install.
///restart computer///
$ brew upgrade git
Error: git-1.8.3.2 already installed
hmm... try doctor again
$ brew doctor
Warning: Experimental support for using Xcode without the "Command Line Tools".
You have only installed Xcode. If stuff is not building, try installing the
"Command Line Tools" package provided by Apple.
Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and what additional flags to use when
compiling and linking.
$ git --version
git version 1.8.3.2
YAY! I DID SOMETHING RIGHT! Now to finish with Homebrew so I can move on to installing ImageMagick:
$ brew doctor
Warning: Experimental support for using Xcode without the "Command Line Tools".
You have only installed Xcode. If stuff is not building, try installing the
"Command Line Tools" package provided by Apple.
Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and what additional flags to use when
compiling and linking.
Arrg... I just installed Xcode. How do I install Command Line Tools? And what is this config Warning? I check it on StackOverflow, and it leads me here:
(.../questions/15225312/brew-doctor-gives-out-warnings)
I don't exactly know what I'm doing, so the following is kinda stupid
$ $PATH
nope
$ echo $PATH
nothing...
$ export PATH=/sm/pkg/active/bin/
nothing
$ export PATH= /sm/pkg/active/bin/
-bash: export: `/sm/pkg/active/bin/': not a valid identifier
(notice the space after the =)
I realize just how much I don't know what I'm doing, so I ask for help
$ brew help
-bash: brew: No such file or directory
uh oh...
$ brew doctor
-bash: brew: No such file or directory
I think I broke my computer, guys. What should I do??? I need to get Homebrew functioning so that I can install the ImageMagick image processor and use the Paperclip gem in Rails.
:((
I know it's super frustrating and some what confusing to get this all to work. Been there, done that.
There are a couple things at play here, so take them one at a time (in fact. I'm just guessing some stuff so I'm happy to update this answer as you let me know more)
Let's start with:
Warning: Experimental support for using Xcode without the "Command Line Tools". You have only installed Xcode. If stuff is not building, try installing the "Command Line Tools" package provided by Apple.
Installing command line tools is highly recommended. It's going to install gcc and other tools that help compile the code that homebrew downloads.
Open Xcode.
Open Preferences.
On the top bar, choose "Downloads"
Install "Command line tools"
Second, I'm not sure how you quite blew away your path. I would first see if you just messed up this terminal and if you close it and start a new terminal window if your PATH is okay.
However, failing that, here's a path that has some basic search paths that will help you get on your way:
export PATH=/usr/local/bin:/usr/bin:/bin:/sbin:/usr/sbin:/usr/local/sbin
You should probably check your .zshrc/.zsh_profile or .bashrc/.bash_profile and see what you are setting your PATH to.
You won't want the space on either side of the = when you are typing that command.
I recently tried the upgrade from 10.6 to 10.8 (to install rails, bundler, RVM) and had lots of the same problems with brew and RVM conflicting AND having their own separate problems (PATH, permissions/non-writable folders, old versions XCode etc). It went off without problems after i tripled backed up everything (TMachine, git and manually copying selected directory trees) and did the clean Mountain Lion install off a USB drive.
If you're only having PATH problems, you could edit it manually/temporarily (until next time .bashrc is run, per comment to the answer: Brew doctor gives out warnings

Heroku toolbelt fails update

I'm trying to get Heroku toolbelt working and it's a total nightmare. The install runs successfully, but when I run heroku update I get:
$ heroku update
failed
! undefined method `output_with_arrow' for #<Heroku::Command::Update:0x108da0120 #options={}, #args=[]>
I've tried everything, including uninstalling my heroku gem and removing the toolbelt via:
rm -rf /usr/loca/heroku
sudo rm /usr/bin/heroku
This is VERY frustrating. My environment is Mac OS 10.7 Lion and:
$ ruby -v
ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-darwin11.3.0]
$ which ruby
/Users/J/.rvm/rubies/ruby-1.9.3-p125/bin/ruby
$ heroku version
heroku-gem/2.19.2
$ which heroku
/usr/bin/heroku
Heroku support finally helped me fix this. Long story short, if you're having this issue, just run:
$ rm -rf ~/.heroku/client
Then reinstall the Heroku Toolbelt from http://toolbelt.heroku.com
If you want the long answer, here you go:
There appear to be some edge cases where update ended up with some
incorrect data and it is somewhat more difficult to recover from this.
If you first delete the ~/.heroku/client directory and subsequently
run the installer you should end up with a working result.
Heroku toolbelt is nice, but heroku_san offers all that and more. Maybe give it a shot?
https://github.com/fastestforward/heroku_san
Dont have much fuss about about uninstalling and reinstalling it again.
Just Delete .heroku folder and it will start working fine...
I had some problems installing Heroku on Windows. After installing and running at the command line for the first time, I got something like "Updating to 5.1.4-cc" and then simply 'panic:'. I couldn't find a '.heroku' folder, and after a lot of messing around, running heroku-cli.exe in {user}AppData\Local\heroku got it past that problem, then everything was good. Until this morning - one day later :) - when it tried updating again, to 5.1.5. I uninstalled everything, re-installed, same issue - but this time there was a '.heroku' folder, and deleting that got past the update issue.
Cheers

Resources