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

Install NodeJS and Yarn for Ruby on Rails

install nodejs for rails

You’ll require Nodejs and Yarn to be installed before your start installing Rails 6.

Download & Install NodeJS

To install NodeJS, simply visit nodejs.org and download the latest or the stable version of Node and install it. With Node installation, you get nodejs, npm, and npx but yarn needs to be installed once you have nodejs installed on your system.

Install Yarn for Rails

npm i -g yarn
Watch me install Nodejs and Yarn on Windows 10

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 a demo app to test if Rails Development environment is set up properly.

rails new demoapp
cd demoapp
rails server

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

Rails Posts you might like

  1. Rails 6 Tutorial – Create your first app
  2. Install Rails without Documentation
  3. How to Install Ruby on Rails 5.1.4 on Ubuntu 16.04 / 17.04

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

3 Responses

  1. Hi

    When I complete everything in last the command prompt says node.js is not installed in windows ( but its installed) also saying that Node.js is not recognized as an internal or external command Please help me