Search code examples
ruby-on-railsrubyshopify-apprailsinstaller-windows

Why is Ruby not updating after updating with Ruby Installer?


I am currently have Ruby version 2.2.6 installed on my Windows 10 machine but need to update order to use the shopify_app gem. I downloaded Ruby 2.5.1-2 (x64) wıthout the devkit as it says on the Ruby Installer site and followed the prompts. I seemingly finished the installation , but entering ruby -v in the command line tells me I am still useing version 2.2.6. I have also tried bundle update which gives the following:

C:\Sites\postgresapp>bundle update
The dependency byebug (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for x86-mingw32 but the dependency is only for ruby. To add those platforms to the bundle, run `bundle lock --add-platform ruby`.
Fetching gem metadata from https://rubygems.org/...........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies........
Using rake 12.3.1
Using concurrent-ruby 1.0.5
Using i18n 1.0.1
Using minitest 5.11.3
Using thread_safe 0.3.6
Using tzinfo 1.2.5
Using activesupport 5.0.7
Using builder 3.2.3
Using erubis 2.7.0
Using mini_portile2 2.3.0
Using nokogiri 1.8.4 (x86-mingw32)
Using rails-dom-testing 2.0.3
Using crass 1.0.4
Using loofah 2.2.2
Using rails-html-sanitizer 1.0.4
Using actionview 5.0.7
Using rack 2.0.5
Using rack-test 0.6.3
Using actionpack 5.0.7
Using nio4r 2.3.1
Using websocket-extensions 0.1.3
Using websocket-driver 0.6.5
Using actioncable 5.0.7
Using globalid 0.4.1
Using activejob 5.0.7
Using mini_mime 1.0.0
Using mail 2.7.0
Using actionmailer 5.0.7
Using activemodel 5.0.7
Using activemodel-serializers-xml 1.0.2
Using arel 7.1.4
Using activerecord 5.0.7
Using activeresource 5.0.0
Using bindex 0.5.0
Using bundler 1.16.2
Using coffee-script-source 1.12.2
Using execjs 2.7.0
Using coffee-script 2.4.1
Using method_source 0.9.0
Using thor 0.20.0
Using railties 5.0.7
Using coffee-rails 4.2.2
Using multipart-post 2.0.0
Using faraday 0.12.2
Using ffi 1.9.25 (x86-mingw32)
Using graphql 1.8.5
Using graphql-client 0.13.0
Using hashie 3.5.7
Using multi_json 1.13.1
Using jbuilder 2.7.0
Using jquery-rails 4.3.3
Using jwt 1.5.6
Using multi_xml 0.6.0
Using oauth2 1.4.0
Using omniauth 1.8.1
Using omniauth-oauth2 1.5.0
Using omniauth-shopify-oauth2 1.2.1
Using pg 0.21.0 (x86-mingw32)
Using puma 3.12.0
Using sprockets 3.7.2
Using sprockets-rails 3.2.1
Using rails 5.0.7
Using rb-fsevent 0.10.3
Using rb-inotify 0.9.10
Using sass-listen 4.0.0
Using sass 3.5.7
Using tilt 2.0.8
Using sass-rails 5.0.7
Using shopify_api 4.12.0
Fetching shopify_app 8.2.6
Installing shopify_app 8.2.6
Gem::InstallError: shopify_app requires Ruby version >= 2.3.1.
An error occurred while installing shopify_app (8.2.6), and Bundler cannot
continue.
Make sure that `gem install shopify_app -v '8.2.6' --source
'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  shopify_app

EDIT: ADD GEMFILE

source 'https://rubygems.org'

git_source(:github) do |repo_name|
  repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
  "https://github.com/#{repo_name}.git"
end

gem 'shopify_app', '~> 8.2.6'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.0.6'
# Use postgresql as the database for Active Record
gem 'pg', '~> 0.18'
# Use Puma as the app server
gem 'puma', '~> 3.0'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
gem 'simple_form'


group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug', platform: :mri
end

group :development do
  # Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
  gem 'web-console', '>= 3.3.0'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
"gem 'shopify_app'"

How can I complete the installation of the latest version of Ruby?


Solution

  • You need to update your PATH environment variable, it is still pointing to the old installation. If I remember correctly, the installer does have a box to check off to set the PATH variable. Only one installation at a time can be in your PATH.

    See this answer for a quick way to change the variable. It will follow the same syntax as the following.

    Open cmd.exe and type:

    set PATH=%PATH%;C:\Ruby250\bin
    

    Your installation location may be different, confirm before entering. You can also do it through the properties window of MyComputer or whatever they call it now. I find the terminal to be simpler, as it take abouts 6 windows deep to change through the GUI.

    Step By Step:

    • Find the directory where ruby is installed to, usually C:\Ruby250\bin (version may vary)
    • Open a command prompt, terminal, cmd.exe, or whatever name you prefer to call it.
    • Type set PATH=%PATH%;C:\Ruby250\bin (change folder name if yours is different)
    • Press Enter button
    • In a new cmd.exe, type ruby -v
    • Enjoy

    ANOTHER EDIT

    • Click on the "Start" button (probably bottom-left of your screen)
    • Start typing the word "environment" until you see the option Edit the system environment variables appear
    • Click on that
    • A small window will open, towards the bottom left is a button that reads Environment Variables
    • Click on that button
    • There will be two sections, one for the user (that is current account only) and the other is the "system", which is the default and system-wide variables
    • In each of these (just to be sure), highlight the line that has "Path" for the name of the variable
    • Find the button under the list that you just clicked in that reads Edit...
    • Click on it
    • Look through list, it is different for everyone, can't read it for you. Find the one that it is the location of a Ruby installation, mine reads C:\Ruby24\bin because I am using Ruby 2.4.4
    • YOU NEED TO MAKE SURE THAT THE FOLDER PATH IS WHERE YOU INSTALLED RUBY. This cannot be done for you, only you know. It is by default C:\RUBY***\bin, where the *** is your version number. You have to open explorer and simply look.
    • If the variable is where is where Ruby 2.5 is installed, good, it doesn't need changed, but look through the list to make sure there are no other paths to other versions of Ruby. If there are, highlight them and click the delete the button to remove.
    • Click OK on each window that you may have made an edit, not Cancel, and not X out the window.
    • To confirm it works, open a new command window, if one was already open, the changes will not be updated in it.