Ubuntu VMWARE Ruby Error - ruby

I am trying to run bundler. My ruby version is 2.3.0 but I keep getting this error.
Your Ruby version is 2.1.2, but your Gemfile specified 2.3.0
Any help is appreciated.
Edit-
Ubuntu version is 14.04.
ruby -v returns 2.3.0.
I am writing in notepad and compiling in terminal.

There are more options to this problem as you did not specifi it to a larger extent. But the options are:
you could have more versions of ruby installed which leads to collisions
if you are using IDE, it could be linked to a wrong version of ruby
if you are not using IDE but terminal, the default ruby might be set to a wrong version
If its not one of these, than you should give us more information on your setup.
Version of Ubuntu
outputs of rvm list or ruby -v from terminal
What are you using to develop? IDE, vim, Sublime, ... etc.
How do you compile it
May be something more, but I cant think of anything now...

Related

Rubocop installation (machine: linux-gnu, Ubuntu)

I go through the process of installing the rubocop gem install rubocop --version 0.86.0
And run rubocop -v afterwards to make sure everything is fine.
Instead, I receive the message below:
warning: parser/current is loading parser/ruby27, which recognizes
warning: 2.7.2-compliant syntax, but you are running 2.7.0.
warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
1.8.1
From what I can understand with my limited knowledge, it says that my ruby version is not compatible. Is that right? That I'm using 2.7.0 and I need to use 2.7.2 or above.
I run rvm ls
=* ruby-2.7.2 [ x86_64 ]
Then I try to run ruby -v
ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux-gnu]
I've gone through the process of rvm install 2.7.2 & rvm use 2.7.2 I have toggled-on 'Run command as a login shell' - because that was the only way I could get 'rvm' to work in the terminal.
If someone is able to help me with how I can upgrade my ruby version, it would be greatly appreciated.
Sidenote - I tried to follow the link https://github.com/whitequark/parser#compatibility-with-ruby-mri. 1.8.1 and I willingly admit I don't understand what's going on, on this page or how I can use it to solve the problem.
Lucas R
You can safely ignore this warning. The parser gem takes things very seriously; it is detecting that you are running a different patch version than it expects (2.7.2 instead of 2.7.0), but there are normally no syntax changes between patch versions.
Unrelated note: rubocop 0.86 is very old; you should upgrade if you can.

Can't start ruby from osx yosemite terminal, before and after rbenv, homebrew works though

Every time I type ruby and hit Enter at my terminal, it just hangs for seemingly forever. This is happening for the default Yosemite install and after I installed with rbenv, using Homebrew (which works fine), using "Ruby on Rails development setup for Mac OSX".
My current Ruby version is 2.2.2, ruby -v works, and I didn't have this problem when I was using OS X Mavericks.
Has anyone else had this problem and/or found a solution? My google-fu doesn't seem to be strong enough.
When you enter ruby at the command-line, it's supposed to "hang forever". It's waiting for you to give it instructions. You can use CTRL+D to get it to stop waiting:
> ruby
puts 1 + 1
2
I then did CTRL+D and returned to the command-line prompt.
Instead though, we don't use Ruby like that. If we want to use it interactively, we use IRb which comes with Ruby. It's the "interactive" Ruby:
> irb
Welcome to IRB. You are using ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin13]. Have fun ;)
>> 1 + 1
2
>> 'foo'.squeeze('o')
"fo"
If we want to run a Ruby script, we use something like:
ruby /path/to/script
and Ruby will load and run it.
I'd recommend reading some Ruby tutorials and learn how the language works before trying to use Rails. Rails uses deep Ruby magic and how Rails works will be unfathomable to you until you do understand better how Ruby is used and how it works and what it can do.
If you're using rbenv to manage your Ruby, then when you enter rbenv versions you should see the Rubies it manages listed:
rbenv versions
system
1.9.3-p551
* 2.2.2 (set by /Users/tinman/.rbenv/version)
If you don't, either rbenv isn't in control of Ruby, or you haven't installed any using rbenv. rbenv global system will tell it to use whatever you have installed by default in the system, based on your PATH.
rbenv's documentation and built-in help go over this so if the problems continue then you need to closely examine your install and setup, because 90% of the problems we see using a sandboxed Ruby are due to people not paying attention to the directions, or using the wrong ones, and not completing the installation.

How to install/use Ruby Shoes (without Hackety Hack)?

SOLUTION:
You have the same problem, you have to compile Shoes (https://github.com/shoes/shoes/wiki/Building-Shoes-on-Linux)
if rake doesn't work, try to install ruby 1.9.2 through rvm.
I recently started to learn Ruby, and i came across this library.
I tried to install it using the .run file provided by the official site, but it seems like it's broken. If i run it, it tells me:
./shoes-3.1.0.run: 1: eval: ./shoes: not found
And yes, after extracting the file, i found a folder which didnt contain it.
The only runnable thing i find is HacketyHack, which worked, but I prefer to use my own editor.
Since I have just started to learn Ruby, I'm not comfortable with playing with the .rb files to get it working outside of HH. I also tried to install it via apt-get, but after running 'shoes', all i get is:
no such file to load -- rubygems
Compiling from source code didn't work for me. Is there anything else I can try, or am I doing something terribly wrong?
The problem seems to be your ruby version. ruby in the apt repositories is version 1.8.7 which is quite old. Try apt-get install ruby1.9.1
If that doesn't work, I would recommend using rvm. Install, then simply rvm install ruby-2.0.0 which is the latest version, then rvm use 2.0.0. If shoes doesn't work under any of these versions, it's probably a bug in shoes.

Can RVM find versions of ruby it did not install?

I'm running os x lion. A version of ruby was installed when I installed the OS. I then installed RVM and then installed ruby 1.9.2 and made it the default for new shells.
Default Ruby (for new shells)
ruby-1.9.2-p290 [ x86_64 ]
What happend to the older version of Ruby that was already on my system and how can I remove it since RVM doesn't see it?
When I try to use the new hash syntax in code written in textmate or sublime text 2 it fails. When the same code is run in the shell it works. So how do I make ruby 1.9.2 the only ruby installed on my system?
You do NOT want to uninstall the system Ruby. It is required for a lot of applications (including RVM) to function properly.
If you want applications like Textmate or Sublime Text to use a different version of Ruby, you can update their individual configuration settings to set the path to the Ruby binary you wish to use.
Since those apps don't run ruby from the shell like you do they don't work seamlessly with RVM. Fortunately RVM's web site has instructions on integrating RVM with TextMate. You shouldn't have trouble applying the same process for Sublime Text 2 but if you do the web does not want for tutorials on the topic.
Also, RVM is not responsible for any ruby it didn't install. the only other ruby it gives access to is the system ruby, and there it doesn't do gemsets etc. (This is also due to systems like debian that specifically block off things like gem update --system so you don't poison the package that was installed. RVM protects from that as well)

Using RVM, how to ensure gems and non-gems see the same version of ruby?

I'm trying to install bdb on Ubuntu as a gem as follows,
gem install bdb
I'm not using sudo, since I am installing with rvm. The ruby version on my system is 1.9.1 but the version I'm using for this installation is 1.8.7 (I'm installing rbot, you see). The problem I've encountered is:
checking for db_version() in -ldb-4.something... no
I assume this means that rubygems is not finding ldb4.something in the places it is looking. Is this because I installed libdb-4.something (7, actually) using sudo, and my system's ruby version is different from the ruby version I'm using for bdb? Using rvm, how should I manage this sort of situation? Maybe I'm doing things wrong, but it seems to me that my problem is that not everything I'm using is a gem, and the stuff that isn't gems is seeing the wrong version of ruby.
(if it turns out that my problem is something completely unrelated: I am still interested in the question. How do things I've installed on my system with a particular version of ruby get along with gems installed using rvm under different versions of ruby?)
"How do things I've installed on my system with a particular version of ruby get along with gems installed using RVM under different versions of ruby?"
They don't, and that is the point. RVM is for managing different versions of Ruby so that they are isolated from each other.
This means that the Ruby versions that you use for system (when you do sudo gem install that would be installing to system) have nothing to do with the current environment (when properly set up.)
When you are in a RVM environment, each version of Ruby installed is an isolated environment.
What I would recommend is this:
Go to the RVM Website and check it out.
At the end of the page, continue with your reading about how to use gemsets.
go to your project directory
rvm use 1.8.7#your_project_environment
create your .rvrmc file so that you will automatically be using this environment in your project on the future visits to this project, this file can contain "rvm use 1.8.7#your_project_environment" which will achieve this.
install all required gems
If you have additional questions, feel free to visit Wayne E. Seguin and a ton of other users of RVM and we will be happy to help you out. Of course, the first search for answers is the documentation on the web site.

Resources