Categories
Ruby on Rails

How to Install Ruby on Rails 6 on Windows 10

Download & Install Ruby on Windows

You can now install both Ruby 2.6 and DevKit together from rubyinstaller website. But if you only need ruby to be installed on your windows system, just download any ruby 2.x version from Ruby without DevKit download section.

https://rubyinstaller.org/downloads/
Download Ruby 2.6.x version without DevKit

Download & Install DevKit on Windows

If you wish to install Ruby on Rails on Windows then you’ll require DevKit, which helps C-extensions compile immediately. Previously DevKit was downloaded and installed separately on Windows systems. Now, both ruby and DevKit can be installed together with just one click from rubyinstaller website.

Download both Ruby 2.6.x and DevKit together

To install Ruby on Rails, you need to install ruby with DevKit. Once your ruby is installed, check the ruby version with following command.

ruby -version

Let’s install Ruby on Rails 6

To install Ruby on Rails 6 without document. I do not prefer installing docs just because it takes time and space on the system.

gem install rails --no-document

It takes time. I know.. After Rails is installed. Just create create a demo app to test if Rails Development environment is set up properly.

rails new demoapp && cd demoapp && rails s

There is possibility that you’ll get errors, to fix errors scroll down. I have listed few common errors with solutions.

Watch me install Ruby on Rails on Windows

Watch me install Ruby on Rails on Windows 10

Rails sqlite3 gem error – Windows 7/8/10

replace gem sqlite3

Replace gem sqlite3 with the following code and run bundle install

gem 'sqlite3', '~> 1.4'

replace with

gem 'sqlite3', git: "https://github.com/larskanis/sqlite3-ruby", branch: "add-gemspec"

or..

gem ‘sqlite3’, ‘~> 1.3’

or ..

gem 'sqlite3'

One of the above must work with your setup, then

bundle install && rails server

RAILS_ENV=development environment is not defined

Simply run the following command, make sure you have already installed nodejs and yarn

rails webpacker:install

Now go ahead and run bundle install and rails server

bundle install 

rails server

ActiveRecord::ConnectionNotEstablished

No connection pool with ‘primary’ found.

Replace the following line in Gemfile

gem 'sqlite3', '~> 1.4'

with

gem "sqlite3"

Puma caught this error: Error loading the ‘sqlite3’ Active Record adapter

In Gemfile replace sqlite3 gem with following command and bundle install

gem 'sqlite3'

Now,

bundle install && rails server

Now run bundle install and rails server

By Tube Mint

I am a YouTuber and I also do niche marketing. In the process of create my niche blog using WordPress, Drupal, and GatsbyJS, I learned a few things like html, css, JS, CMS, MVC frameworks, C++, Python, Ruby, MySQL, Windows and Linux. After some time.. I realized that I can share my knowledge with people on YouTube and through my blog. So, here I am. You can ask me if you have any question about these technologies.
Thanks,
@TubeMint