2

Please pardon my errors (if any) as this is my first question here.

I just successfully installed ruby on my Ubuntu 20.04 following this guide: https://github.com/jhu-ep-coursera/fullstack-course1-module1/commit/170f351229887f54f154fba637048520041951b4

However after doing ruby -v (line 71) to display version of ruby installed, I get an error:

Command 'ruby' not found, but can be installed with:

sudo snap install ruby # version 2.7.2, or sudo apt install ruby # version 1:2.7+1

See 'snap info ruby' for additional versions.

I have tried reinstalling ruby using the same procedure but to no avail. I have also tried searching for similar questions but the ones I found were for installing ruby using rvm whereas in my own case, I am using rbenv.

I will like to know what I might be missing out, and how to fix the error.

Many thanks in anticipation.

1 Answers1

0

I found a way to fix the problem. First, I deleted every file associated with rbenv and ruby installations. These are: .rbenv folder in Home directory and the ruby-build folder in /tmp directory.

I then did a fresh re-install using rbenv beginning from step one: https://github.com/jhu-ep-coursera/fullstack-course1-module1/commit/170f351229887f54f154fba637048520041951b4

The installation was successful as usual, and doing ruby -v this time displayed the installed ruby version:

ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-linux]

I'm not sure what exactly went wrong, though I have some suspicions:

  1. The network was unstable during the previous installs. In fact, the installation failed earlier about three times due to Download failure. Could it be that the unsuccessful installations created some files which affected the later installations?
  2. I checked the /tmp folder directory again after the last installation that worked and I discovered that there was no ruby-build folder (asides the ruby-build log file) unlike the previous installations. Can anyone explain why?
  3. I compared the log files of one of the previous installation that threw an error after running ruby -v and the log file of the last installation that worked. The output of the previous installation:

/tmp/ruby-build.20201024162152.8685.pHbqqa ~ curl: (56) OpenSSL SSL_read: Connection reset by peer, errno 104

The log file seems to me that there was network interruption which affected the installation process.

But, why then did the terminal displayed that the installation was successful until I did ruby -v?

Many thanks.