I'm working on a project in ruby 2.1.10. it should be using rails 4.0.13.
I'm using rbenv.
I've installed everything, I believe. I ran bundle install for the project. eventually I got it to run.
However, now I get:
turlingdrome$ rails
Rails is not currently installed on this system. To get the latest version, simply type:
$ sudo gem install rails
You can then rerun your "rails" command.
turlingdrome$ gem install rails -v 4.0.13
Successfully installed rails-4.0.13
Parsing documentation for rails-4.0.13
Done installing documentation for rails after 1 seconds
1 gem installed
turlingdrome$ which rails
/Users/brianp/.rbenv/shims/rails
turlingdrome$ rails -v
Rails is not currently installed on this system. To get the latest version, simply type:
$ sudo gem install rails
You can then rerun your "rails" command.
turlingdrome$ ruby -v
ruby 2.1.10p492 (2016-04-01 revision 54464) [x86_64-darwin16.0]
in case it matters, I'm on a mac running 10.12.6
ETA from comment:
turlingdrome$ bundle exec rails -v
Rails 4.0.13
so, bundle exec lets me run rails. rbenv exec rails seems to work too.
So, the problem seems to be in the shim!
Rehash the shims:
rbenv rehash
Now you should be able to run only rails without bundle exec or rbenv exec.
Related
I am using ruby 2.7.6 for my project. On my laptop (KDE Neon) it was installed via rbenv and was working correctly.
After KDE was updated today I started getting
Your Ruby version is 3.0.2, but your Gemfile specified 2.7.6
To fix that I tried reinstalling both rbenv and ruby that comes with Ubuntu. Also tried rbenv rehash with no results. So far rbenv installs ruby correctly and correct vesion is displayed when I do ruby -v or bundle install in project folder but trying to run rails s gives me an error
Your Ruby version is 3.0.2, but your Gemfile specified 2.7.6
rbenv is installed into /home/some_user/.rbenv/
$PATH shows
bash: /home/some_user/.rbenv/shims:/home/some_user/.rbenv/shims:/home/some_user/.rbenv/bin:/home/some_user/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin which I am not sure is correct.
You're not running the correct rails executable. Try prefixing your rails command with bundle exec, for example if you want to run the dev server, type bundle exec rails s instead of rails s.
ruby -v
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-linux]
cat Gemfile.lock | grep -A 2 RUBY
RUBY VERSION
ruby 2.7.1p83
bundle platform --ruby
ruby 2.7.1p83
sudo rake db:create
Your Ruby version is 2.7.0, but your Gemfile specified 2.7.1
I can't see what is the problem here. This is a fresh installation of Ubuntu it's 20.04 and I was trying to set up a ruby on rails env for the first time.
Different users can have different versions of ruby installed.
When you run ruby -v you will see the version of ruby in your user environment.
When you run sudo rake ... (or sudo anything) you will use the version of ruby in the super user’s environment.
In short, don’t use sudo. bundle exec rake db:migrate Will ensure you’re using the same version of ruby as you see in the output of bundle platform —ruby
To help understand what’s happening when you try to check the version, try sudo ruby -v That should be where v2.7.0 comes from
I am trying to get my rails environment working on a mac with the latest mac OS. I have ruby installed...
ruby -v
ruby 2.1.3p242 (2014-09-19 revision 47630) [x86_64-darwin14.0]
When I try to start a rails server I get this message...
rails -s
Rails is not currently installed on this system. To get the latest version, simply type:
$ sudo gem install rails
You can then rerun your "rails" command.
So I run 'sudo gem install rails' and get ....
ERROR: While executing gem ... (Gem::RemoteFetcher::UnknownHostError)
no such name (https://api.rubygems.org/gems/thread_safe-0.3.4.gem)
How would I get around this error?
DNS issue with rubygems is now resolved so all is well, thanks again Shibi for the status update!
Hi i'm new to ruby on rails
I have 3 ruby version in my computer.
In a project i had to use rails 3.2.1 and ruby 1.9.2
So I switched using rvm use 1.9.2 in terminal. But after that my rails commands are not detected.
$ rails g model abc
The program 'rails' is currently not installed. You can install it by typing:
sudo apt-get install rails
Why is this happening? And how to solve this?
You may need to differentiate your gem set that contains that specific version of rails from the old ones.
rvm use 1.9.2#new_gem_set_of_yours --create --default
And then retry installing the 3.2.1 rails
gem install rails --version 3.2.1
Or specify the new rails version in your Gemfile and let Bundler take care of it
gem 'rails', '3.2.1'
and run bundle install.
Type in your terminal
gem install rails -v 3.2.1
if it does not work, first try
rvm install 1.9.3
then
rvm rubygems current
and repeat.
So I run this command successfully: sudo gem install rails
It outputs: Successfully installed rails-3.0.10
However, whenever I type in rails -v it shows: Rails 1.2.6
How can this be? Whenever I create a new project and do rails server, localhost:3000 doesn't work.
It's likely that your system has rails preinstalled, and the rubygems version is not overriding it.
You might have luck installing rvm and then installing rails within an rvm gemset.