rubyjs / therubyrhino

Embed the Mozilla Rhino Javascript interpreter into Ruby
155 stars 40 forks source link

undefined method `useMozillaStackStyle' #29

Closed KaptajnKold closed 10 years ago

KaptajnKold commented 10 years ago

As soon as I try to require "rhino", I get this error:

NoMethodError: undefined method `useMozillaStackStyle' for Java::OrgMozillaJavascript::RhinoException:Class
    from /Users/adam/.rvm/gems/jruby-1.7.8/gems/therubyrhino-1.73.5/lib/rhino/error.rb:71:in `JSError'
    from /Users/adam/.rvm/gems/jruby-1.7.8/gems/therubyrhino-1.73.5/lib/rhino/error.rb:3:in `Rhino'
    from /Users/adam/.rvm/gems/jruby-1.7.8/gems/therubyrhino-1.73.5/lib/rhino/error.rb:1:in `(root)'
    from org/jruby/RubyKernel.java:1084:in `require'
    from /Users/adam/.rvm/rubies/jruby-1.7.8/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:1:in `(root)'
    from /Users/adam/.rvm/rubies/jruby-1.7.8/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:55:in `require'
    from org/jruby/RubyKernel.java:1084:in `require'
    from /Users/adam/.rvm/gems/jruby-1.7.8/gems/therubyrhino-1.73.5/lib/rhino.rb:26:in `(root)'
    from /Users/adam/.rvm/rubies/jruby-1.7.8/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:1:in `(root)'
    from org/jruby/RubyKernel.java:1123:in `eval'
    from /Users/adam/.rvm/rubies/jruby-1.7.8/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:135:in `require'
    from (irb):1:in `evaluate'
    from org/jruby/RubyKernel.java:1519:in `loop'
    from org/jruby/RubyKernel.java:1284:in `catch'
    from org/jruby/RubyKernel.java:1284:in `catch'
    from /Users/adam/.rvm/rubies/jruby-1.7.8/bin/irb:13:in `(root)'

This happens for in both version 1.73.5 and version 2.0.3 of therubyrhino. The only way to get it to work is to comment out the offending line. Any idea why this might be happening to me?

kares commented 10 years ago

it's very likely similar to #18 ... check your class-path for possible .jar files that contain an older version of rhino packaged.

lolindrath commented 10 years ago

I ran into the same issue. Both uglifier and jslint_on_rails were depending on execjs and I think somehow Rhino got pulled in twice. Once I removed jslint_on_rails it worked as expected.

My recommendation is to look at your Gemfile.lock and see who's depending on execjs and play around with removing different sets of those gems.

kares commented 10 years ago

@lolindrath excellent, thanks!

digitalextremist commented 10 years ago

I notice this intermittently - unpredictably. One of my gems requires execjs > 0.3.0 and another doesn't specify. I am manually requiring 2.0.2 now. Has anyone determined which version is most likely to work without displaying the error shown?