0

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?

Owen
  • 361
  • 1
  • 5
  • 16
  • If you could, post all your environment variables you have defined (see instructions below), it will be mean far more than the irrelevant gemspec file. This is technically a "Windows" question, not Ruby. Be sure to edit the list if has your name or anything else in it that you don't want to show online, or even just a screenshot. – ForeverZer0 Jul 29 '18 at 21:38

1 Answers1

1

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.
ForeverZer0
  • 2,379
  • 1
  • 24
  • 32
  • i have read this answer but i dont understand it. it is leaving out steps. i didnt see anything in the installation about path variables. what is this PATH ? – Owen Jul 28 '18 at 18:17
  • I added a step-by-step. If that fails, google `change PATH environment variable`, there will be thousands of instructions online, with pictures. There are various ways of changing it. – ForeverZer0 Jul 28 '18 at 18:25
  • STEP 1: do you mean where the old version is installed to or the new version that i just downloaded is installed to? And how do i find the directory? STEP 3: when you say 'change folder name' which part of 'set PATH=%PATH%;C:\Ruby250\bin' do i change and what to? If you could fill in these blanks i will try to follow the steps, thanks. – Owen Jul 29 '18 at 06:35
  • The system has to know where to find Ruby. The path just does that. Step1 : yes your new installation of Ruby. Step3 : just change the path (C:...) that you just found at Step 1. Alternatively you can access the paths by through the Windows environment : https://www.java.com/en/download/help/path.xml (don mess with it, just add the Ruby path and delete the old ones, if you delete a path that should be there, your system may have trouble finding some programs) – Maxence Jul 29 '18 at 10:45
  • I have been coding Ruby on Windows for about a year. It is very time consuming. A new install takes a lot of time. Some gems are difficult to install (curb for example). And some windows "flags" appear in your gemfile.lock. Among other issues. If you feel confident enough try to switch to Linux (Ubuntu). It takes time to learn but you will save quite some time in your Ruby coding. – Maxence Jul 29 '18 at 10:48
  • I have updated with the most comprehensive way I know how to explain, the same way I would to a grandparent. – ForeverZer0 Jul 29 '18 at 19:01
  • i tried typing: ''C:\Sites\postgresapp>set PATH=%PATH%;C:\Ruby25-x64\bin'' But the ruby version has not changed. typing the following: ''C:\Sites\postgresapp>ruby -v'' Prosuces: ''ruby 2.2.6p396 (2016-11-15 revision 56800) [i386-mingw32]'' C:\Sites\postgresapp> – Owen Jul 29 '18 at 19:02
  • repeated previous step after reinstalling using the new "C:\Ruby25-x64\bin'' with the same result as above. what could i be doing wrong? – Owen Jul 29 '18 at 20:02
  • Then it wasn't done correctly. `cmd` would not even know what `ruby` was being typed into it if you removed the old path from it. – ForeverZer0 Jul 29 '18 at 20:05
  • i have found the following two possibilities in my PATH list: "C:\RailsInstaller\Ruby2.2.0\bin" and "C:\RailsInstaller\Ruby2.3.0\bin". i think the second is from a previous attempt to update a few months ago. I dont see any path related to the version i just installed now which was 2.5. should i reinstall a 3rd time? – Owen Jul 30 '18 at 09:25
  • Reinstalling is not going to help, it is still going to load Ruby from those directories first. Can probably just get away by adding `C:\Ruby25-x64\bin` if it isn't there, and using the `Move Up` and `Move Down` buttons to make sure it is higher on the list than them, so it will be searched first. – ForeverZer0 Jul 30 '18 at 09:38
  • i tried installing a different version 2.3 because 2.5 was doing nothing. now i have the environment variable there because 2.3 gave me the option to add it upon installation whereas 2.5 didnt. i typed "set PATH=%PATH%;C:\Ruby23-x64\bin" into the command prompt. this changed the version of ruby, but only on the command prompt NOT the command promt with ruby on rails. when i load the RoR command prompt the version is the old version. why could this be? – Owen Jul 30 '18 at 09:52
  • In command prompt `gem install rails` Gems aren't shared between Ruby installations. – ForeverZer0 Jul 30 '18 at 10:17
  • current version of ruby seems to be located in C:/RailsInstaller/Ruby2.0.0/bin/ruby.exe. however the two other versions i have now installed are in C: directory and not C:/Railsinstaller directory. could this make a difference? – Owen Jul 30 '18 at 10:17
  • to update. It seems as if both 2.3 and 2.5 versions are located in the C: directory. so i have now set the Path variable to use the 2.5 version. i.e. C:\Ruby25-x64\bin is at the top of the list of PATH variables. Typing" set PATH=%PATH%;C:\Ruby25-x64\bin" into cmd prompt with RoR has no effect on the version number when new cmd is opened. I think i have followed the instructions correctly. what else could i try? – Owen Jul 30 '18 at 10:25
  • What do you mean by Command prompt with ROR ? A while back when I was coding under Windows I only used the command prompt, not any other type of command prompt. If when you type `ruby -v` it returns 2.5 you're set. It means the Windows environment is using your new install as default Ruby version. And also if you have set your path from the list of paths, you don need to reiterate with `set PATH=%PATH%;C:\Ruby25-x64\bin` it can only do at best duplicate your path (which will have no effect) – Maxence Jul 30 '18 at 12:55
  • @Maxence. i can open command prompt as normal but when i use rails i open it and it is somehow connected to ruby on rails and has "command prompt with ruby and rails" in the title. i have set the path but it has no effect. i have also deleted the old paths – Owen Jul 30 '18 at 14:13
  • @Maxence in command prompt it says ruby version is 2.5.1. BUT the gem that i am trying to use wont install because it says i need at least version 2.3.1. which i now have. but in the ruby on rails command prompt the version is still the old 2.2.6. so there is one final step that i am missing. – Owen Jul 30 '18 at 15:02
  • In your gemfile, have you versioned ruby with something like `ruby '2.5.0'` ? (with the previous Ruby version you were using) that could be an issue. Also when you install a new ruby version you need to reinstall everything in your new ruby 2.5 folder. Your Ruby folder is kinda empty of any gem required in your app. In your normal prompt, do `gem install bundler` then do `bundle install` (in your ROR application folder of course) – Maxence Jul 30 '18 at 15:05
  • @Maxence. i added ruby '2.5.1' but it still says its 2.2.6. C:\Sites\postgresapp>bundle install Your Ruby version is 2.2.6, but your Gemfile specified 2.5.1 – Owen Jul 30 '18 at 15:47
  • Then I don' t know what's wrong. this is very strange. If you use normal command prompt (not Command prompt with Ruby or Command prompt with Ruby on Rails) and `ruby -v` returns Ruby 2.5.1 then it should work. I will let other contributors try to help you. Try to restart computer in case the path variable has not been accounted yet. – Maxence Jul 30 '18 at 16:07