Closed overtube closed 10 months ago
This is a very weird one 🤔
What is failing here is the installation of libv8-node (here https://github.com/rubyjs/libv8-node/blob/v18.16.0.0/ext/libv8-node/location.rb#L19-L23). The NoMethodError
is coming from here https://github.com/ruby/ruby/blob/v3_1_2/ext/psych/lib/psych.rb#L452-L461, which makes no sense at all to me. On first sight, I'd say there is something messed up with your Ruby environment.
Can you run these commands and show the output?
ruby -ryaml -e 'puts YAML.safe_load("---\nhello: world\n").inspect'
ruby -ryaml -e "puts Psych::Parser.new.respond_to?(:parse)"
ruby -ryaml -e 'YAML.safe_load("--- !ruby/object:Libv8::Node::Location::Vendor {}")'
The last should raise an exception (Psych::DisallowedClass
) which is okay. But it should not raise NoMethodError
.
Have you seen this before, @lloeki?
{"hello"=>"world"}
true
/home/ui/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/psych-5.1.0/lib/psych/class_loader.rb:99:in `find': Tried to load unspecified class: Libv8::Node::Location::Vendor (Psych::DisallowedClass)
from /home/ui/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/psych-5.1.0/lib/psych/class_loader.rb:28:in `load'
from /home/ui/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/psych-5.1.0/lib/psych/visitors/to_ruby.rb:426:in `resolve_class'
from /home/ui/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/psych-5.1.0/lib/psych/visitors/to_ruby.rb:215:in `visit_Psych_Nodes_Mapping'
from /home/ui/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/psych-5.1.0/lib/psych/visitors/visitor.rb:30:in `visit'
from /home/ui/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/psych-5.1.0/lib/psych/visitors/visitor.rb:6:in `accept'
from /home/ui/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/psych-5.1.0/lib/psych/visitors/to_ruby.rb:35:in `accept'
from /home/ui/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/psych-5.1.0/lib/psych/visitors/to_ruby.rb:320:in `visit_Psych_Nodes_Document'
from /home/ui/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/psych-5.1.0/lib/psych/visitors/visitor.rb:30:in `visit'
from /home/ui/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/psych-5.1.0/lib/psych/visitors/visitor.rb:6:in `accept'
from /home/ui/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/psych-5.1.0/lib/psych/visitors/to_ruby.rb:35:in `accept'
from /home/ui/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/psych-5.1.0/lib/psych.rb:334:in `safe_load'
from -e:1:in `<main>'
Have you seen this before, @lloeki?
Psych::DisallowedClass
yes, but I seem to recall this was addressed. NoMethodError
, never.
Not sure how to investigate further, but what I just noticed from your stacktraces, @overtube: When installing libv8-node the Ruby bundled psych got used. With the execution of the snippets I gave you, it was the psych gem (/home/ui/.rbenv/versions/3.1.2/lib/ruby/3.1.0/psych.rb
vs /home/ui/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/psych-5.1.0/lib/psych.rb
).
To get another data point, can you try this with Ruby 3.2.2?
It worked for me after updating my ruby version from 3.0.0
to 3.2.2
.
For anyone else coming across this, this was caused by a bug in rubygems < 3.4.9
. So you can also fix it on older versions of ruby (e.g. ruby 3.0, 3.1) by updating your version of rubygems:
gem update --system
See https://github.com/rubygems/rubygems/pull/6490 for the PR in rubygems that fixed this bug, which was released in rubygems 3.4.10 .
Thanks for the comment, @gravitystorm 🙏
Super difficult to make the troubleshooting guide in the README more visible. Almost all reported bugs are solved by what we have at https://github.com/rubyjs/mini_racer#supported-ruby-versions--troubleshooting.
gem_make.out
mkmf.log