1

I recently started testing out the Ubuntu bash for Windows 10 sub-system for my Ruby and Rails work. To set up rails, I followed this guide from GoRails.com.

Everything worked yesterday. But after shutting down my PC and starting up the Ubuntu bash terminal again today, it doesn't seem to recognize ruby or rails anymore. i.e. typing ruby -v gives me this:

The program 'ruby' is currently not installed. You can install it by typing: sudo apt install ruby

Typing rails -v gives me:

bash: /mnt/c/Ruby22-x64/bin/rails: ruby: bad interpreter: No such file or directory

For reference, I used the instructions from the above guide to install Ruby 2.4.0 using RVM and Rails 5.1.1. When I ran ruby -v and rails -v yesterday, everything worked fine.

I should note, that before testing out the Ubuntu sub-system, I've been using Ruby and Rails on Windows itself - In this case, I have Ruby 2.2.5 (64-bit) installed using an installer downloaded from here. I installed Rails on Windows by running gem install rails on the Windows command prompt.

I am on Windows 10 Home Version 1703 (OS Build 15063.483)

3
  • You probably need to do the source ~/.rvm/scripts/rvm line from the guide each time you open a new shell, unless you add that your shell's initialization file.
    – jordanm
    Jul 21, 2017 at 6:42
  • This worked like a charm! Thank you so much! If you could put it as an answer I can mark it as the best answer! Jul 21, 2017 at 11:38
  • 1
    For reference, @jordanm if it helps your answer, I also used the code echo "source \$HOME/.rvm/scripts/rvm" >> ~/.bashrc from here to make this command happen automatically when running the bash terminal :) Jul 21, 2017 at 11:42

2 Answers 2

0

from your story above, probably how you start the terminal (command prompt)

if you run using go rails make sure your run the terminal with bash, press start, then search for bash then you click bash icon

if you using ruby from ruby installer / rails installer you search "command prompt with ruby and rails" and click the icon

1
  • Thanks for the answer! But turns out it was that I needed to run an RVM command before using ruby (See the comment on the question). Thanks anyway! Jul 21, 2017 at 11:40
0

Firstly install ruby using rvm manager. It enables you to switch between different ruby versions as per your project. Follow the instructions on this website:

http://rvm.io/rvm/install

and install ruby through rvm. For the problem of unable to detect ruby on your system change settings for your terminal through Edit->preferences/profile preferences -> command ->(tick mark) run command as login shell.

1
  • Unfortunately, these aren't available on the Ubuntu bash for Windows 10 :( Turns out it was that I needed to run an RVM command before using ruby (See the comment on my question above). Thanks anyway! Jul 21, 2017 at 11:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.