Home>
Ruby environment construction (Windows)
Error messageInstalled ruby 2.4.9 using RubyInstaller2 with MSYS2 installer.
I checked the installation of Ruby by entering ruby -v at the command prompt.
Using Atom, I created a directory called index.rb in a folder called ruby_lesson.
Even if cd Desktop and cd ruby_lesson are executed at the command prompt, the following error code 1 is displayed.
Furthermore, even if ruby index.rb is executed, the command in the directory is not executed and the following error code 2 is displayed.
Error code 1: The specified path cannot be found
Error code 2: ruby: No such file or directory-index.rb (LoadError)
Applicable source code
Ruby
-
Answer # 1
Related articles
- ruby on rails - in the development of docker + rails + puma + nginx, i want to check the puma log in real time (also for debuggi
- ruby on rails - creating a follow function i don't understand the error
- [ruby on rails] i want to implement a follow function, but the like button is not displayed in the view
- ruby - [rails] follow function cannot be implemented
- ruby - when you edit the code only in the development environment when you require an external module, if you just reload the sc
- ruby on rails 5 - create a post list page for users who follow
cd Desktop
means "Move the current directory to a directory called Desktop in the current directory".An error occurs if there is no Desktop directory in the current directory.
Similarly,
ruby index.rb
means "execute a file called index.rb in the current directory with ruby", so it is called index.rb in the current directory. If there is no file, an error occurs.If you are working with files and directories that should be in the current directory, if you are a beginner, you should make sure they are in the current directory. You can check with the
dir
command. If it is not displayed with thedir
command, it will not be there (although it may be a hidden file on Windows).I think that there is a file called
index.rb
in a folder calledruby_lesson
In Explorer, with the folder
ruby_lesson
open, entercmd
in the part surrounded by the red frame below to open the command prompt with that as the current directory So, after confirming thatindex.rb
exists indir
, enterruby index.rb
.