castwide / vscode-solargraph

A Visual Studio Code extension for Solargraph.
Other
425 stars 23 forks source link

incompatible library version - nokogiri.bundle #103

Open Nowaker opened 5 years ago

Nowaker commented 5 years ago
[Error - 1:48:08 PM] Server initialization failed.
  Message: [LoadError] incompatible library version - /Users/nowaker/.rvm/gems/ruby-2.6.1/gems/nokogiri-1.10.1/lib/nokogiri/nokogiri.bundle
  Code: -32603 

I don't know what the problem is but Nokogiri gem is alright.

nowaker@nwkr-newmbp ~/projects/dreamhost/ndn-terraform (git)-[master] % irb
2.6.1 :001 > require 'nokogiri'
 => true
2.6.1 :002 > doc = Nokogiri.parse '<xml>test</xml>'
 => #<Nokogiri::XML::Document:0x3fc29541ec44 name="document" children=[#<Nokogiri::XML::Element:0x3fc29541e7d0 name="xml" children=[#<Nokogiri::XML::Text:0x3fc29541e398 "test">]>]>

Happy to provide more info if needed, just let me know what.

arg commented 5 years ago

Having the same issue

[Error - 4:08:10 PM] Server initialization failed.
  Message: [LoadError] incompatible library version - /Users/arg/.rvm/gems/ruby-2.6.2@global/gems/psych-3.1.0/lib/psych.bundle
  Code: -32603 
castwide commented 5 years ago

@Nowaker sorry for the delay in replying. I let this issue slip under my radar somehow.

Do either of you get a backtrace or any additional information in the developer console?

A cursory search suggests that the problem could stem from a version discrepancy with a native library like libxml2, but I'm not sure that's the case here. Example: https://stackoverflow.com/questions/18818926/incompatible-library-version-nokogiri-bundle-requires-version-11-0-0-or-later

Nowaker commented 5 years ago

Unfortunately, this is everything that shows up in VS Code. And as indicated in actual terminal window, Nokogiri is doing fine. So I guess the VS plugin itself could provide more debug information - e.g. print the stacktrace, maybe some environment like Ruby binary used.

cancerberoSgx commented 5 years ago

Same here, macos:

[Error - 11:09:59 AM] Server initialization failed.
  Message: [LoadError] incompatible library version - /Users/wyeworks/.gem/ruby/2.6.5/gems/nokogiri-1.10.5/lib/nokogiri/nokogiri.bundle
  Code: -32603 

No other debug information. Any workaround ?

cancerberoSgx commented 5 years ago

This is how I solved the issue:

gem install --version 1.9.1 nokogiri

before I had nokogiri@1.10.1 and that one was the cause of mentioned incompatibility. Hope this helps others. Thanks

jpaas commented 4 years ago

The only workaround I've found is to change my solargraph.commandPath setting to point directly at the solargraph binary in my rvm gemset. No amount of messing with the version of nokogiri helped.

This is of course less than ideal if you are working on multiple projects.

jpaas commented 4 years ago

I'm running 0.21.1. For some reason 0.22.0 is not available as a version to install.

Nowaker commented 4 years ago

@cancerberoSgx Advising to gem uninstall something is not correct. Gem directory is shared across many projects, and each projects picks a version to use with Bundler.

vscode-solargraph likely has a bug that it does not pin the correct version of solargraph and nokogiri gems using Bundler, and instead, uses whatever is available to its dismay.

cancerberoSgx commented 4 years ago

Advising to gem uninstall something is not correct.

Thanks. Comment edited. (I'm getting started with ruby).

batamire commented 4 years ago
$ gem list nokogiri
*** LOCAL GEMS ***
nokogiri (1.10.6, 1.10.5, 1.10.1, 1.9.1)

$ gem uninstall nokogiri -v 1.10.6
Successfully uninstalled nokogiri-1.10.6

everything ok again :)

forsbergplustwo commented 4 years ago

Tried all solutions here, and the only one that worked was to add the commandPath to the solargraph gem in my VSCode settings.json file directly.

1- Get your solargraph gem path:

$ which solargraph
$ /Users/FORSBERGtwo/.rvm/gems/ruby-2.6.5/bin/solargraph

2- Open up VSCode settings.json file, and add the following line to your config:

  "solargraph.commandPath": "/Users/FORSBERGtwo/.rvm/gems/ruby-2.6.5/bin/solargraph",

3- Restart VSCode

Drawback to this is it points to a specific Ruby version of the gem

acooxy commented 4 years ago

I had the same issue, I resolved mine by removing rm /Users/argi/.gem/ruby/2.6.0/gems/nokogiri-1.10.4/lib/nokogiri/nokogiri.bundle and did bundle install