I installed ruby, rails, postgresql on freshly installed Manjaro linux.
[thiebo#Ruth ~]$ rails -v
Rails 6.0.3
[thiebo#Ruth ~]$ ruby -v
ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux]
I could create a new app with rails new mynewapp and that works fine.
I then downloaded my app already live on heroku. When I change directory to my app downloaded from heroku and command rails server, I get bash: rails: command not found.
the app from heroku was with rails 5.2.3 so I expected quite some error messages and necessary upgrade from rails 5.2.3 to rails 6.2. But I can't explain and don't know how to solve the command not found.
You need to install Rails per each version of Ruby on your machine and you need to install each version of Rails that is required by apps running under a specific version of Ruby.
Therefore you need to run
bundle install
after downloading your application to install all required dependencies for the current Ruby version.
Related
Trying to install rails version 4.2.5 on Ubuntu in Windows Subsystem for Linux on Windows 10 when I have ruby 2.2.1 installed and active I get the following error:
~$ gem install rails -v 4.2.5
ERROR: Error installing rails:
nokogiri requires Ruby version >= 2.3.0.
I need these versions to collaborate on a project which uses these versions.
I started by installing WSL (1 not 2) on windows 10, then downloaded and installed Ubuntu Linux. Then I installed rbenv, updated dependencies, installed ruby 2.5.1 which was fairly easy.
I had problems installing ruby 2.2.1 but got there after doing
$ sudo apt-get install -y libssl1.0-dev
to install an earlier version of libssl which ruby 2.2.1 needs.
I installed node.js and an earlier version of bundler using
$ gem install bundler -v 1.17.3
as trying
$ gem install bundler
failed with a similar error.
(I also installed ruby 2.5.1 and rails 4.2.5 on top of it with few problems)
Trying various diagnostics showed rails was not installed for ruby 2.2.1
~$ rails
rbenv: rails: command not found
The `rails' command exists in these Ruby versions:
2.5.1
(but not in ruby 2.2.1, which is where I need it)
Looking at my files in windows File Explorer (only looking) I can see that while my ruby 2.5.1 gems include rails my ruby 2.2.1 files are incomplete and do not include rails.
I think the PATH is correct.
$ echo $PATH returns
/home/johnloughran/.rbenv/plugins/ruby- build/bin:/home/johnloughran/.rbenv/shims:/home/johnloughran/.rbenv/bin:/usr/
local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local
/games:/mnt/c/Program
Files/WindowsApps/CanonicalGroupLimited.Ubuntu18.04onWindows_1804.2019.522.0_
x64__79rhkp1fndgsc: ........ :/snap/bin
I modified my .bashrc file to add various entries to the PATH which have been included above.
I repeated the whole process twice starting from scratch (uninstalling Ubuntu) with the same block at the end.
What is my best option here to try and continue?
Thanks Josien for your comments. In the first case my collaborators have these versions of Ruby and Rails working together, but its a few years now since they installed them. One, David, helped me by trying a fresh install of rails 4.2.5 on ruby 2.2.1 which ran into the same problem above with nokogiri.
He solved it by installing a lower version of nokogiri in a new test directory, which I repeated as:
test$ gem install nokogiri -v 1.9.1
This worked. Then I installed rails as
test$ gem install rails --version 4.2.5
At last .... it worked!!!! :-)
To prove it I was able to get rails to return its version correctly.
test$ rails -v
Rails 4.2.5
Then I was able to create an app as
<working-directory>$ rails new learn-ruby
which works, almost, having hit another dependency problem, but hey ... that's programming!
Re your second comment I do not know enough about this stuff to know how relevant it is that this version of ruby is deprecated and the rails version is getting there too.
I have installed Ruby 2.4.4 Development Kit. Then I installed Ruby on Rails Installer for Windows.
ruby -v
gave me before Rails installation the correct version 2.4.4 but now I only have 2.3.3
I tried to reinstall Ruby 2.4.4 but it never changed the version back to 2.4.4.
Did I make a mistake by installing Ruby and should I just deinstall everything again and install Ruby on Rails if it comes with Ruby anyways?
OR am I completely wrong and everything is just fine as it is? Do I now have multiple redundant versions of Ruby or is it intended?!
Pls help my confusion
Thnak you
Do I need to install Ruby before installing Ruby on Rails from official sources for Windows
The simple answer is Yes.
If you install using RailsInstaller then don't need this before because this software has included with Ruby.
RailsInstaller packages included are
Ruby
Rails
Bundler
...
The Simple Steps
Follow those steps, actually, I have installed Ruby on Rails to many windows machine using these steps.
Step 1: Download Git BASH as the BASH emulation behaves just like the "git" command in LINUX and UNIX environments.
Step 1.1: Download and install latest NodeJS from here and check the NodeJS version
$ node -v
#=> v6.11.5 # or something like this
Step 2: Download the ruby latest version here and install it in your directory. Check the Ruby version
$ ruby -v
#=> ruby 2.3.1p112 (2016-04-26 revision 54768) [x64-mingw32]
# or something like this
Step 3: Download Devkit here take the suitable one for matching your windows bit like 32 or 64 bit
Step 4: Create a devkit folder inside Ruby directory that means where created a default directory after installing ruby software, something like this disk (:C) or (:D)/Ruby25/devkit/
Step 5: Extract the DevKit file inside the devkit folder
Step 6: Open your GIT BASH inside the devkit folder and run this two commands
$ ruby dk.rb init
$ ruby dk.rb install
if above command running properly then done.
Step 7: Now you can run rails command for installing inside ruby folder
$ gem install rails
Step 8: Check the Rails version
$ rails -v
#=> Rails 5.0.6
if till now all are steps is ok? that's it, now run rails command and create a rails project, like
$ rails new project
create
create README.md
create Rakefile
create config.ru
create .gitignore
create Gemfile
create app
create app/assets/config/manifest.js
............
Hope it helps
Hi I'm following Rails Tutorial using Cloud9 ...
Tutorial says to install Rails 4.2.2. Before I did, I ran "rails -v" and saw that it was 4.2.1.
I ran Gem install Rails 4.2.2 and a load of stuff was installed. Tutoral then said to execute Rails 4.2.2 New MyApp. I decided to see what would happen if I did Rails 4.2.1 New Myapp, expecting an error (since 4.2.2 is installed and not 4.2.1 [I think] ), only to get successful execution.
Why is this? Thanks.
Because that version is available in your default gem set which is associated to the Ruby version you are using. Run gem list rails and it will list the rails versions that you have. Try running rails _4.2.3_ new myApp but instead of _4.2.3_ use a version not listed and you will get an error,Could not find 'railties' (= x.x.x) If you install the rails version with gem install rails -v x.x.x you will have that rails version available for that ruby version. Also if you cd to your application and run rails -v it will output the rails version of that one application.
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.
I am trying to get my Instant Rails working on my Windows 7 laptop.
The error I keep getting when trying to access my site files are:
c:/rails/ruby/lib/site_ruby/1.8/rubygems.rb:779:in 'report_activate_error'
RubyGem version error: rack<1.1.0 not~> 1.0.1> <Gem::LoadError>
from c:/rails/ruby/lib/ruby.site_ruby/1.8/rubygems.rb:214:in 'activate'
from c:/rails/ruby/lib/ruby.site_ruby/1.8/rubygems.rb:1082:in 'gem'
from c:/depot/vendor/rails/actionpack/lib/action_controller.rb:34
from c://rails/ruby/lib/ruby.site_ruby/1.8/rubygems/custom_require.rb:31 in 'gem_original_require'
etc...
I have intalled Rubygems 1.3.7 and they work fine and when I run the test it works and the gem env shows that the 1.3.7 has been installed correctly.
What can I do to get this working?
Any prompt help would be VERY appreciated.
Thanks
Your rack gem is outdated. Try to run gem update rack. Or, if you use Rails with Bundler, just run bundle install in the root of your project and it will do everything for you.
I decided to write a little manual about the Ruby 1.8.7 and Rails stable installation.
Download RubyInstaller 1.8.7 from here. During the installation, check the 'Add Ruby executables to your PATH' box. After the installation, don't forget to restard cmd. Then try running ruby -v and gem -v to check for installed Ruby 1.8.7 and RubyGems 1.3.7;
Install the latest stable Rails 2.3.8 using gem install rails --no-ri --no-rdoc; Check it using rails -v;
Create a new application using rails myapp;
Test it: script/server. That's it!
gem install rack -v 1.0.1