Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't find gem railties (>= 0.a) with executable rails (Gem::GemNotFoundException)

I am trying to build a new application or check the version of rails. I get the following error:

Traceback (most recent call last):
    2: from /usr/local/bin/rails:22:in `<main>'
    1: from /Users/vivanksharma/.rbenv/versions/2.5.1/lib/ruby/2.5.0/rubygems.rb:263:in `bin_path'
/Users/vivanksharma/.rbenv/versions/2.5.1/lib/ruby/2.5.0/rubygems.rb:289:in `find_spec_for_exe': can't find gem railties (>= 0.a) with executable rails (Gem::GemNotFoundException)

I searched many different solutions, but none of them worked for me.

Any help would be great.

ruby -v ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin17]

rbenv -v rbenv 1.1.1

Even executing bundle install gives an error Could not locate Gemfile.

like image 773
Vivank Sharma Avatar asked Aug 28 '18 06:08

Vivank Sharma


3 Answers

I'd to run rvm reset and it started working. The solution I found was connected with rvm warning "Warning! PATH is not properly set up, /Users/xxx/.rvm/gems/ruby-2.5.3/bin is not at first place.". (OSX Catalina)

like image 89
majchr_ Avatar answered Nov 20 '22 15:11

majchr_


try to run gem install bundler then run bundle

if you still getting the error then run,

bundle install --path vendor/bundle
like image 17
Cryptex Technologies Avatar answered Nov 20 '22 16:11

Cryptex Technologies


I got the same error while creating a new gemset and querying the rails version. In my case, I simply had not installed the rails gem yet.
I just needed to do the following:

for a current stable release:
$ gem install rails

to get a specific version, say 5.2.2.0:
gem install rails --version=5.2.2.0

Hope that helps.

like image 13
bpaysen Avatar answered Nov 20 '22 15:11

bpaysen