Rails Installation/Startup Issue - ruby-on-rails

I made a mistake earlier today where I ran a git clean -f command and it seems to have wiped out rails and rvm. I tried to re-install both, and the installations seemed to work, but when I try to run the rails -v I get a gem load error. This tells me that the installation did not work properly, even though I watched railties get installed a few minutes ago. Does anyone have any advice for this sitation? Or do you have experience troubleshooting an error like this?
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb:296:into_specs': Could not find 'railties' (>= 0) among 19 total gem(s) (Gem::LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb:307:into_spec'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:47:ingem'
from /usr/bin/rails:22:in <main>'

try the simple stuff first, bundle install, restoring from git depending on what your branches were. Finally you made need to just uninstall and reinstall
How can I uninstall Ruby on Rails on Mac OS X?
https://gauravsohoni.wordpress.com/2014/01/01/rvm-implode-and-rvm-install/

Related

Rails bundle error when pushing to Elastic Beanstalk

I had an app deployed on Heroku and I am currently trying to create the same app on AWS.
I've copied my folder, created a complete separated repo on Github and installed ebcli, the setup looks fine.
When I try to run eb deploy, I have this error:
[Instance: i-03051e2a022886184] Command failed on instance. Return code: 1 Output: (TRUNCATED)...:in find_spec_for_exe': can't find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException)
from /opt/rubies/ruby-2.5.3/lib/ruby/site_ruby/2.5.0/rubygems.rb:308:inactivate_bin_path'
from /opt/rubies/ruby-2.5.3/bin/bundle:23:in `'.
I've looked online and it says it comes from incompatibility between your gemlock file bundler version and actual bundler version.
I've tried to change my bundler version to this one, but I gave up and came back to 2.0.1 because I had to install too many dependencies otherwise.
I removed the gemlock, bundle again, but I still got the same error when trying to deploy.
With my heroku version, it always worked.
Any idea how to solve that?
Thanks a lot
We moved from Heroku to AWS a few months back as well and it will likely take some some custom scripting to get things to work.
It would help to know more about your EB environment, but I am assuming you are using Ruby 2.5 with Puma on Amazon Linux 2.9.0 (?)
Not sure what bundle version comes with that, But I don’t think it’s 2.x. so you have to add an .ebextensions file too install your preferred bundled version.
# .ebextensions/01_install_bundler.config
container_commands:
install_bundler:
command: “gem install bundler —-version 2.0.0”
More info on AWS Linux customizations
End of the day, we are much happier with our AWS environment (lower cost, better performance), but requires more work to get it set up
Actually the problem exists because the bundler version in the eb env is older than the one being used in the project source.
So the solution is to use a bundler version less or equal the eb env installed version.
First uninstalled the current bundler:
gem uninstall bundle
and then install the desired one:
gem install bundler -v 1.16.6
See more details

GEM_PATH is looking in /usr/local/rvm/gems, which has been deleted

I messed up my development environment while working on my rails app, so I attempted to completely remove rvm, rails and ruby from my system so I could start fresh. I then installed rbenv, ruby and rails.
Now I am getting the following error when i try to use the rails s command:
/usr/lib/ruby/2.3.0/rubygems/dependency.rb:319:in `to_specs': Could not find 'railties' (>= 0.a) among 5 total gem(s) (Gem::LoadError)
Checked in 'GEM_PATH=/usr/local/rvm/gems/ruby-2.3.0:/usr/local/rvm/gems/ruby-2.3.0#global', execute `gem env` for more information
from /usr/lib/ruby/2.3.0/rubygems/dependency.rb:328:in `to_spec'
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_gem.rb:65:in `gem'
from /usr/local/bin/rails:22:in `<main>'
I am assuming this is because I removed the 'usr/local/rvm' folder, but it is still trying to look there. I'm thinking I need to change the GEM_PATH, but I'm not sure how. If anyone can help me, that would be great, I am totally lost.
I resolve the problem reinstalling rails, I belive that my RVM was confuse, anyway first try to config your terminal ubuntu first and next reinstall
$ gem install rails

Reinstall Rails every time I restart my computer?

My issue concerns my inability to keep a working version of RoR on my mac OSX 10.6.8. I've been working through various books that teach Rails, but the biggest issue I keep running into is that the Rails installation seems to disappear whenever I restart my computer. I have a directory on my desktop, within which I put all of my Rails projects. Whenever I attempt to open that folder in terminal and create a new rails app,
rails new examplename
I get met with this error:
/Library/Ruby/Site/1.8/rubygems/dependency.rb:313:in `to_specs':
Could not find 'rails' (>= 0) among 12 total gem(s) (Gem::LoadError)
Checked in
'GEM_PATH=/Users/greyelerson/.rvm/gems/ruby-1.9.3-p547:/Users/greyelerson/.rvm/gems/ruby-1.9.3- p547#global', execute `gem env` for more information
from /Library/Ruby/Site/1.8/rubygems/dependency.rb:322:in `to_spec'
from /Library/Ruby/Site/1.8/rubygems/core_ext/kernel_gem.rb:58:in `gem'
from /usr/bin/rails:18
The only "solution" which has allowed me to continue thus far has been to completely reinstall ruby and then reinstall rails every time I want to work. There has got to be a real and permanent fix for this. Please help.
Rather than installing Rails into the system version of Ruby, I would recommend that you instead install your own copy of Ruby in your home directory using RVM. That way, your changes won't conflict with the system's changes. For example, if Apple decides to update Ruby to a new version that's incompatible with your version of Rails, you're still safe because you have your own version in your home directory. You can also install multiple versions of Ruby if you want to test your code with beta versions or whatever.

Could not find RubyGem rails - Rails Server error

I'm new to rails/ruby and I'm following a tutorial on how to create your first app using git and heroku!
After figuring out the sqlite3 debacle, the error I receive now comes every time I try to start a server.
rails server
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:827:in `report_activate_error': Could not find RubyGem rails (>= 0) (Gem::LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:261:in `activate'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:68:in `gem'
from /usr/bin/rails:18
This error is a pain in the arse, and I don't know how to get around it. There's several articles on here about this particular error, but no one mentions receiving this error while trying to launch the server.
Is there anybody out there that could walk me through the steps to take to remedy this.
Should I provide my gemfile
Should I also provide my database.yml file for reviewing
Logs, anything else I'm not mentioning that could be of help to figure out the source of this problem
Let me know, I'm trying to move forward ad don't want to be stuck at this particular error for days.
First you should install rvm: https://rvm.io/rvm/install then you should install ruby =< 1.9.3
rvm install 2.1
then you should install rails
rvm use 2.1 && gem install rails
then
cd PROJECT_PATH && rails server
everything should work fine

Restarting Rails for terminal session

I was doing the Ruby on Rails tutorial by Martl and closed my terminal on my Mac. I had reached Chapter 10 without a problem. When I opened another terminal nothing is working. When I run bundle install I get the following error message:
/Library/Ruby/Site/1.8/rubygems/dependency.rb:247:in to_specs': Could not find bundler (>= 0) amongst [rake-0.8.7, rake-0.8.7] (Gem::LoadError)
from /Library/Ruby/Site/1.8/rubygems/dependency.rb:256:into_spec'
from /Library/Ruby/Site/1.8/rubygems.rb:1182:in `gem'
from /usr/bin/bundle:18
How do I get my terminal back to where it was?
Sounds like your RVM environment is not being loaded when you restart your terminal. The Ruby On Rails tutorial glosses over RVM installation rather quickly and thats why this step often gets missed.
Check out the RVM installation guide here in particular Section 2 which describes how to ensure the RVM commands go into your .bash_profile.
Let me know if you need further help.

Resources