I'm completely new to Ruby (and RoR) and I'm trying to set up a local environment to help work on a site. Ideally, I would work on it locally, and then commit the changes to github and push it further down the pipeline from there.
I'm on a brand new Macbook Pro running OSX Lion.
I have had much trouble trying to get it work:
Installed Xcode Command Line Tools and RVM couldn't install latest version of ruby because it failed to compile with LLVM (Lion default compiler)
compiled ruby using a special flag it asked me to use (forgot what it was), but then was having trouble with Postgres and Pow
Tried installing a standalone GCC to compile ruby correctly thinking it may solve the problem. Pow still gave me errors.
I have tried removing and installing everything I could think of, and still nothing. I stress: I'm a noob.
I finally found a script called railsready that sets up ruby and RoR for you (https://github.com/joshfng/railsready) which failed to recognize Xcode since Lion installs it into Applications (the script checked for it by looking for an Xcode .plist file in Library/Developer). The author helped be out by updating the code to look for gcc instead and it tried installing but failed because it couldn't write to my .bash_profile. I removed it and tried it again, and it worked.
I installed Pow so I can have it run on a custom domain (website.dev) and have multiple apps under different domains. Now it's giving me this error and I have no idea what it means or how to go about it.
I would really appreciate any help. Most ruby guys I talk to have no idea what this is about, and why Lion is so much trouble to set up on. They are on older (Snow Leopard) machines.
The Error
Your Rack app raised an exception when Pow tried to run it.
LoadError: no such file to load -- bundler/setup
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
~/Github/letsordernow/config/boot.rb:6
~/Github/letsordernow/config/application.rb:1:in `require'
~/Github/letsordernow/config/application.rb:1
~/Github/letsordernow/config/environment.rb:2:in `require'
~/Github/letsordernow/config/environment.rb:2
~/Github/letsordernow/config.ru:3:in `require'
~/Github/letsordernow/config.ru:3
~/Library/Application Support/Pow/Versions/0.3.2/node_modules/nack/lib/nack/builder.rb:4:in `instance_eval'
~/Library/Application Support/Pow/Versions/0.3.2/node_modules/nack/lib/nack/builder.rb:4:in `initialize'
~/Github/letsordernow/config.ru:1:in `new'
~/Github/letsordernow/config.ru:1
Welcome to Ruby On Rails. :)
You're going to love the new Rails.app Kickstarter project by Yehuda Katz:
http://www.kickstarter.com/projects/1397300529/railsapp
My advice for now:
Standalone GCC is good. You're doing this right.
To use RVM with Lion and non-LLVM, read about compiling Ruby with clang: Can't install Ruby under Lion with RVM – GCC issues
In each of your Rails projects, run this which may clean up your Pow issues:
bundle install
Make sure each of your projects has a .rvmrc file pointing to the correct ruby version and gemset.
My two cents is to try to get up and running without RVM and Pow to start. These aren't needed and they have quirks with paths and glitches (IMHO). I personally prefer to use bundler to manage gemsets, and the rbenv tool and ruby-build tool for managing Ruby versions. See https://github.com/sstephenson/rbenv
Pow is nifty but tricky. It has a history of quirky setup (IMHO). My two cents is to get up and running with webrick first (i.e. make sure you can do "rails s" to start a local server) and then I personally like Apache and Passenger (or Thin). For Pow help on quirky setup see https://github.com/37signals/pow/issues/119
Related
My RubyGems isn't working, throwing an error which goes as follows, triggering (nearly) on any Gem task:
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems.rb:1081:in `<top (required)>': uninitialized constant Gem::GEM_PRELUDE_SUCKAGE (NameError)
from <internal:gem_prelude>:1:in `require'
from <internal:gem_prelude>:1:in `<compiled>'
I'm new to Ruby / RubyGems / installing Ruby and all I know is that an uninitialized constant is essentially a undefined variable. It could also be possible that it's something with Ruby itself, although the ->Gem:GEM<-_PRELUDE_SUCKAGE points me to RubyGems.
In a nutshell, I installed a bunch of Ruby things (think RVM, rbenv, etc.) to develop Ruby on Rails, as I thought it would be a good way to learn Ruby.
Well, after going through a long and tedious process to upgrade Ruby to 2.6.3, then downgrade to 2.5.5 and then 2.4.0, then back up to 2.5.5 and solving downgrade issues, RubyGems throws the error. I settled on 2.5.5 because 2.6.3 caused errors and 2.4.0 was too early of a version.
It's causing all sorts of errors, like HAML not compiling and Rails not making a controller. I really don't know what's happening.
If I run gem install [gem name], it throws the error. Running rails generate controller [name] index (for those not familiar to Rails this creates, well, a controller) it throws the error. Doing anything really with the gem command causes the error, except for gem server.
If I upgrade back up to the latest Ruby version, I fear that my gem command will go all wonky again and I'll have to go through another day of troubleshooting versions. How do I fix this, or at least get rid of the message so I can create things again?
I had this happen to me just today. It seems, somehow, my ruby version had been corrupted. When I ran rvm list version 2.5.1 was listed as 'broken'. I had to uninstall 2.5.1 fully (using sudo even in my case) to get to a clean slate.
Then, when attempting to reinstall, rvm was giving me all kinds of grief after a new gpg key which I initialy couldn't get to install properly (hint).
After a clean wipe of ruby 2.5.1, updating rvm to latest version and reinstalling, I got this error: Error running 'env GEM_HOME=/ruby-2.5.1#global GEM_PATH= /Users/user/.rvm/rubies/ruby-2.5.1/bin/ruby -d /Users/user/.rvm/src/rubygems-3.0.8/setup.rb --no-document',.
It appears that an update to MacOSX deprecated a version of OpenSSL which causes some issues. I ended up following this thread and ran rvm gemset create global --default and then bundle install to get passed the Gem errors.
Honestly, rails is supposed to be easier than this. I wish docker was easier to reason about sometimes. These are the kinds of issues docker supposedly promises to fix eh?
I'm new to both Ruby and Sinatra/Padrino so I apologize if I'm missing something really simple.
I have Sinatra working fine, as I can build a very simple "hello" app and see it work.
I wanted to move on and generate a new Padrino project, but when I do this:
$ padrino g project foobar
I get this:
/Users/dave/.rvm/gems/ruby-2.1.5/gems/activesupport-4.2.0/lib/active_support/ordered_hash.rb:3:in `<top (required)>': undefined method `add_builtin_type' for Psych:Module (NoMethodError)
from /Users/dave/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:121:in `require'
from /Users/dave/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:121:in `require'
from /Users/dave/.rvm/gems/ruby-2.1.5/gems/padrino-gen-0.12.4/lib/padrino-gen.rb:3:in `<top (required)>'
from /Users/dave/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/dave/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/dave/.rvm/gems/ruby-2.1.5/gems/padrino-gen-0.12.4/bin/padrino-gen:12:in `<main>'
I have tried installing the Psych gem but this didn't change anything. I have no idea what to try next, or how to really interpret the error message. Any nudges in the right direction you can give me?
Bug reports show this may be an RVM issue.
I suggest changing from RVM to "ruby-install" and "chruby" because IMHO these are simpler, easier, and better at installing dependencies including psych and its libraries.
As joelparkerhenderson noted, the error message shows problems with gem files in the .rvm directory, suggesting some issue or conflict with rvm. Switching to system ruby solved the problem for me. I don't really need to use a specific version of ruby on this project, so that's a fine workaround for me.
I had this problem while using Ruby 2.1.5. After reading comments on here I realized it's not a RVM problem, but a ruby problem. I switched to 2.0.0-p576 and everything works. Psych must not be compatible with the new ruby versions.
However I don't understand how a different ruby version would cause this method to go missing. If anyone could explain that I would be grateful!
I ran into this using rbenv and padrino 0.13.0. Tried many versions of Ruby, including the system Ruby on OS X El Capitan, but found that that made no difference, so I'm now running the latest stable one (2.2.4).
Eventually I tried each version of the psych gem and found I could only get padrino g to work with an older version of the gem. Psych version 2.0.8 worked, while every newer version (up to the current 2.0.16) failed.
So: gem install psych -v=2.0.8 && gem uninstall psych -v '>= 2.0.9'
With me, after a lot of googling and reading various thread on S.O., it was only my rvm that was the problem. I was getting the rvm 'WARNING!' that rvm wasn't first in $PATH. You can check this with echo $PATH. Check out your ~/.bashrc see if there is anything like heroku toolbelt or linuxbrew, or whatever, loading themselves into your PATH at the FRONT i.e. PRE-PENDING your path, rather than APPENDING. This is indicated by something like export PATH="/usr/local/heroku/bin:$PATH". That sets heroku at the beginning of your PATH. Simply change it to export PATH="$PATH:/usr/local/heroku/bin".
I was trying to start a padrino project with activesupport, and this was causing problems. Changing to an earlier version of Ruby, as suggested in another thread, didn't cut it, because activesupport requires 2.2.0 or up.
Fixing my PATH, ensuring that rvm was initialized at the very beginning of the PATH, fixed my Padrino problem, and was able to initialize a project with the following command:
padrino g project sample_blog -t shoulda -e haml -c sass -s jquery -d activerecord -b
I know that's all a little off-tangent, but I think it's bound to help one or two people out there!
PS I'm using ruby 2.2.2p95 in this project folder.
I was happily using Emacs's evernote-mode until stupidly removed OS X system ruby (I'm on Yosemite). Then I tried installing one via RVM (first tried 2.0 then 1.9), got all necessary gems, yet thing is still broken. Throws this message:
$HOME/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- oauth (LoadError)
from $HOME/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:54:in `require'
from $HOME/.rvm/rubies/ruby-1.9.3-p551/bin/enclient.rb:40:in `<main>'
Please help me to fix that
upd: I don't see the point of reinstalling system ruby (as people suggested) and then having it conflicting with those that I want to use via RVM. Ruby developers advise to use RVM. I symlinked my default Ruby to /usr/bin/ruby.
I seems that specific script uses something I don't have. I remember having hard time figuring out all dependencies and gems and installing them the first time I used that script and after hours of investigating it finally worked. But this time I got stuck.
I tried to run the script outside of Emacs and it runs with no errors (maybe that's not enough to find what's broken)
I tried to run irb and require modules one by one. It says => true until reaches require 'oauth/consumer'. I guess that's what's missing maybe? I run gem install oauth_consumer. It installed few gems, and now says => true for oauth/consumer in irb, the script though still doesn't work
i removed systems ruby once. i just had to go to the trash and put back everything i deleted and it worked for me. don't know how you "removed" your system ruby. besides, if you installed one with RVM then you have to tell RVM to choose and use/set a default ruby. because RVM won't install ruby 1.9.1 (rather a higher version which i think you did). So you have to set to that version.
Like this:
$ rvm --default use 2.1.5
don't forget to install oauth as well. Hope it helps.
I'm trying to get Capistrano to work on my MacBook (OSX Mountain Lion) but am having a lot of difficulties. It started with it throwing an error:
cillosis:myapp macbook$ cap deploy
/Library/Ruby/Gems/1.8/gems/sshkit-1.2.0/lib/sshkit.rb:32: undefined method `require_relative' for main:Object (NoMethodError)
from /Library/Ruby/Site/1.8/rubygems/core_ext/kernel_require.rb:55:in `gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Library/Ruby/Gems/1.8/gems/capistrano-3.0.1/lib/capistrano/all.rb:2
from /Library/Ruby/Site/1.8/rubygems/core_ext/kernel_require.rb:55:in `gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Library/Ruby/Gems/1.8/gems/capistrano-3.0.1/bin/cap:2
from /usr/bin/cap:19:in `load'
from /usr/bin/cap:19
It seemed I had Ruby 1.8 installed and it doesn't work correctly with Capistrano (found this Googling around).
So I installed Ruby 2.0 using rvm. RVM starting throwing a bunch of errors so I got rid of it using rvm implode and found that the 2.0 version was still on my computer. I checked my $PATH and the locations it pointed at contained the Ruby 1.8. So I renamed that to *ruby_old* and copied the new ruby to that folder (/usr/bin). Then when I did a ruby -v it came back as version 2.0. So I thought, great, now we can finally run Capistrano.
Just to be sure, I did a gem update which came back as having updated the sshkit gem which was throwing the error before. So I go to deploy, and get the same exact error as I started with.
I know the deploy.rb script is correct because I use it all the time on another Mac.
TL;DR; After some fumbling, when I type ruby -v it comes back as using version 2.0 but when I do a cap deploy with Capistrano, it tries to use version 1.8 of ruby. How do I fix this?
The dumb, but simple way out would be to completely remove RVM and both ruby versions, then install again from scratch. I would recommend 1.9.x over 2.0 due to some gems not being up to speed yet, but that's up to you.
Another option would be to specify the ruby version in your gemfile (as heroku does it), then do a "bundle exec cap deploy". Again, no guarantees - but it might force capistrano to behave the way you want until you find a proper solution.
i originally followed these steps to get a RoR environmentgoing: https://help.ubuntu.com/community/RubyOnRails
that worked. then i put 1.9.2 on here. then i decided i want the original setup, did a "whereis ruby" and deleted those directories manually.
that fubar'd my ruby installation. i can't use the repository to what i originally had. how can i purge ruby from completely and start fresh?
right now the specific error is this:
/usr/lib/ruby/1.8/rubygems.rb:11:in `require': no such file to load -- thread (LoadError)
from /usr/lib/ruby/1.8/rubygems.rb:11
from /usr/bin/gem1.8:8:in `require'
from /usr/bin/gem1.8:8
tipu#tipu_ubuntu:~$
You're not giving enough real information to be specific, but this is what I'd try:
Use apt-search to locate Ruby 1.8.7 for your OS version.
Using apt-get, uninstall that version so you're back to what APT thinks is a clean slate.
Again using apt-get, reinstall that version so you're back to what APT thinks is a normal installation.
From that point, I would STOP messing with the system Ruby, and instead use RVM to manage and install any new Ruby and gems installations into RVM's ~/.rvm sandbox.
To follow up on the Tin Man's answer:
I wrote a guide to installing Ruby and Rails on Ubuntu which you may find useful for getting this all peachy again.
Hope it helps!
You need to reinstall libruby1.8. I'm pretty sure that will take care of it. I had exactly the same problem.