I
I
Ilya17912017-05-25 14:20:43
ruby
Ilya1791, 2017-05-25 14:20:43

Error when changing directory in Ruby?

Good afternoon!
The first day I work with Ruby, I need to install Ruby Gems. I downloaded the archive, unpacked it into a folder.
As far as I understand, you need to navigate to a directory in Ruby by entering the full path to it, for example,
C:\Ruby23\bin>. But when I try to do this, it gives me an error syntax error, unexpected $undefined, expecting tSTRING_CONTENT or tSTRING_DBEG or tSTRING_DVAR or tSTRING__END, and swears at the character after the slash, which is after C:. I did not find any information on the Internet.
Tell me, please, am I doing something wrong? Or is it a bug in the program itself?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Artur Bordenyuk, 2017-05-25
@HighQuality

What is required in the end from Ruby for your current tasks?
If the development of complex things on Ruby on Rails, then I recommend that you immediately take a closer look at vagrant + ubuntu. RubyMine (IDE by JetBrains) works well with vagrant.
If you really, really need to start ruby ​​directly under Windows, you need to use RubyInstaller , then add the path to the bin folder in the PATH environment variable.
If everything is done correctly, even in the old cmd, you can turn to ruby, rubigems and test your applications.
87643dc33cf944ecb8a87fc5299bdd83.png

R
Roman Mirilaczvili, 2017-05-25
@2ord

The gem command should only be used from the cmd.exe command line. In the language interpreter (irb), you need to enter Ruby syntax commands. Since C:\Ruby23\binthis is a command for cmd.exe, it is logical that the Ruby interpreter complains about invalid syntax.
In order for cmd to know the location of ruby.exe, you need to set a user environment variable.
If you did everything right, then when you output the command, it ruby -vwill display the version of Ruby.
Now it does not matter what directory you are in and you can call Ruby scripts by calling the command
Check which gem version you can do this:
cmd.exe:
gem -v

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question