vscode-solargraph icon indicating copy to clipboard operation
vscode-solargraph copied to clipboard

incompatible library version - nokogiri.bundle

Open Nowaker opened this issue 5 years ago • 14 comments

[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">]>]>
  • VS Code, Version 1.31.1
  • OSX, High Sierra, Version 10.13.6 (17G5019)

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

Nowaker avatar Feb 22 '19 12:02 Nowaker

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 

arg avatar Apr 29 '19 13:04 arg

@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

castwide avatar Apr 29 '19 16:04 castwide

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.

Nowaker avatar Apr 29 '19 19:04 Nowaker

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 avatar Nov 19 '19 14:11 cancerberoSgx

This is how I solved the issue:

gem install --version 1.9.1 nokogiri

before I had [email protected] and that one was the cause of mentioned incompatibility. Hope this helps others. Thanks

cancerberoSgx avatar Nov 25 '19 13:11 cancerberoSgx

This also just popped up for me upgrading from 0.37 to 0.38, also macos

maddawik avatar Dec 02 '19 18:12 maddawik

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 avatar Dec 11 '19 14:12 jpaas

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

jpaas avatar Dec 11 '19 14:12 jpaas

@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.

Nowaker avatar Dec 11 '19 23:12 Nowaker

Just doing gem install --version 1.9.1 nokogiri was enough for solargraph to be happy in my case, didn't need to uninstall any other versions. Again for me this was going for solargraph version 0.37 to 0.38.

maddawik avatar Dec 13 '19 00:12 maddawik

Advising to gem uninstall something is not correct.

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

cancerberoSgx avatar Dec 13 '19 18:12 cancerberoSgx

$ 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 :)

batamire avatar Dec 16 '19 09:12 batamire

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

forsbergplustwo avatar Jan 27 '20 10:01 forsbergplustwo

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

acooxy avatar Sep 07 '20 12:09 acooxy