简体   繁体   中英

LoadError on Ruby

I just installed Atom text editor and Ruby, typed a single line of ruby code in the Atom text editor; puts "Hello world" but the Atom Runner returns with an error message;

ruby: No such file or directory -- C:/Users/OKaro/Desktop/Ruby/example.rb (LoadError).

How can I fix this?

Am using a Windows 10 PC, running ruby 2.5.3p105
Atom : 1.35.1
Electron: 2.0.18

I have tried running the ruby code with command prompt and it works perfectly. giving me the desired Hello world output

Figuring out what your current working directory is for your running script.

Add this line at your code:

puts Dir.pwd

This code print's the path of your file.

Then check if your atom-runner is configured to accept ruby scripts on config.cson file (Atom -> Config) like atom-runner documentation says to do

Atom-runner

"*":
....
'runner':
    'scopes':
      'coffee': 'coffee'
      'js': 'node'
      'ruby': 'ruby'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM