Ask coding questions

← Back to all posts
Cannot run my main.rb anymore
LaiLai4

I was practicing ruby this afternoon, and then it suddenly showed the error message below. Now I cannot Run my main.rb anymore. Can anyone help me fix this?

The console shows the message below:
warning: parser/current is loading parser/ruby25, which recognizes
warning: 2.5.8-compliant syntax, but you are running 2.5.1.
warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
(string):1:7: error: unexpected token tEQL
(string):1: :name = "123" # 語法錯誤
(string):1: ^
/var/lib/gems/2.5.0/gems/parser-2.7.2.0/lib/parser/diagnostic/engine.rb:72:in process': unexpected token tEQL (Parser::SyntaxError) from /var/lib/gems/2.5.0/gems/parser-2.7.2.0/lib/parser/base.rb:285:inon_error'
from /usr/lib/ruby/2.5.0/racc/parser.rb:259:in _racc_do_parse_c' from /usr/lib/ruby/2.5.0/racc/parser.rb:259:indo_parse'
from /var/lib/gems/2.5.0/gems/parser-2.7.2.0/lib/parser/base.rb:189:in parse' from /var/lib/gems/2.5.0/gems/parser-2.7.2.0/lib/parser/base.rb:33:inparse'
from -e:15:in guess_gems' from -e:57:inblock in <main>'
from -e:56:in each' from -e:56:in<main>'
exit status 1

Repl.it: Package operation failed.

Answered by Zavexeon [earned 5 cycles]
View Answer
Voters
LaiLai4
Comments
hotnewtop
Zavexeon

It looks like that package you are trying to install was built using a higher version (2.5.8), while repl.it currently uses 2.5.5. Maybe that is in relation to the issue.

LaiLai4

@Zavexeon uh...I have no idea about the package. There's one thing I know is that " require './file.rb' " leads to the problem. Maybe this is a bug?

Zavexeon

@LaiLai4 Try require_relative './file.rb'.

LaiLai4

@Zavexeon It works !!!!!!! Thanks:)

Zavexeon

@LaiLai4 Glad to hear!

dreamorange830

I have same question,
but I'don't know this code <require_relative './file.rb'> need to keyin where that could be work.

dreamorange830

I have try key in on repllit console and myself terminal, but both not work.

Coder100

Yeah, repl.it's package manager for ruby does not work very well at all.
Report to bugs: https://repl.it/bugs

BananaJellyfish

well, it says that 'cal' is undefined, where did you get 'cal' for the cal.rb from

LaiLai4

@BananaJellyfish I created a file named cal.rb, and tried to require it but failed. However, it goes well with load.