Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails to load #63

Closed
spiffistan opened this issue Jun 12, 2018 · 11 comments
Closed

Fails to load #63

spiffistan opened this issue Jun 12, 2018 · 11 comments

Comments

@spiffistan
Copy link

Solargraph fails to load with the following error on MacOS.

Using RVM latest, rvm is set to default gemset, ruby 2.5.1.

I have tried different approaches, including:

  • setting the command
  • using bundler
  • setting ruby interpreter (via vscode-ruby)
  • launching with code . after rvm use 2.5.1 --default

Note that solargraph is working properly when launched with solargraph socket anywhere, including VSCode terminal, and that all libraries are installed in all gemsets and have been made pristine.

Why is it using linked system libraries (Ruby.framework), when otool -L reports that the ruby in use is not linked to these? Is VSCode insisting on using system ruby, but local gems?

Is it possible to have the plugin connect to a separately running instance of solargraph socket?

/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:268 [Extension Host] Ignoring bcrypt-3.1.12 because its extensions are not built.  Try: gem pristine bcrypt --version 3.1.12
Ignoring byebug-9.0.6 because its extensions are not built.  Try: gem pristine byebug --version 9.0.6
Ignoring eventmachine-1.2.7 because its extensions are not built.  Try: gem pristine eventmachine --version 1.2.7
Ignoring executable-hooks-1.4.2 because its extensions are not built.  Try: gem pristine executable-hooks --version 1.4.2
Ignoring ffi-1.9.18 because its extensions are not built.  Try: gem pristine ffi --version 1.9.18
Ignoring gem-wrappers-1.3.2 because its extensions are not built.  Try: gem pristine gem-wrappers --version 1.3.2
Ignoring jaro_winkler-1.5.1 because its extensions are not built.  Try: gem pristine jaro_winkler --version 1.5.1
Ignoring nio4r-2.3.1 because its extensions are not built.  Try: gem pristine nio4r --version 2.3.1
Ignoring nokogiri-1.8.0 because its extensions are not built.  Try: gem pristine nokogiri --version 1.8.0
Ignoring pg-0.21.0 because its extensions are not built.  Try: gem pristine pg --version 0.21.0
Ignoring shoulda-callback-matchers-1.1.4 because its extensions are not built.  Try: gem pristine shoulda-callback-matchers --version 1.1.4
Ignoring websocket-driver-0.6.5 because its extensions are not built.  Try: gem pristine websocket-driver --version 0.6.5
Ignoring bcrypt-3.1.12 because its extensions are not built.  Try: gem pristine bcrypt --version 3.1.12
Ignoring byebug-9.0.6 because its extensions are not built.  Try: gem pristine byebug --version 9.0.6
/Users/username/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.2/lib/bundler/spec_set.rb:91:in `block in materialize': Could not find nokogiri-1.8.0 in any of the sources (Bundler::GemNotFound)
  from /Users/username/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.2/lib/bundler/spec_set.rb:85:in `map!'
  from /Users/username/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.2/lib/bundler/spec_set.rb:85:in `materialize'
  from /Users/username/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.2/lib/bundler/definition.rb:171:in `specs'
  from /Users/username/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.2/lib/bundler/definition.rb:238:in `specs_for'
  from /Users/username/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.2/lib/bundler/definition.rb:227:in `requested_specs'
  from /Users/username/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.2/lib/bundler/runtime.rb:108:in `block in definition_method'
  from /Users/username/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.2/lib/bundler/runtime.rb:20:in `setup'
  from /Users/username/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.2/lib/bundler.rb:107:in `setup'
  from /Users/username/.rvm/gems/ruby-2.5.1/gems/bundler-1.16.2/lib/bundler/setup.rb:20:in `<top (required)>'
  from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
  from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
@castwide
Copy link
Owner

Did you get that error while using Bundler (i.e., solargraph.useBundler is true)? If so, is solargraph installed in your Gemfile? Have you run bundle install?

@castwide
Copy link
Owner

Incidentally, if you're able to run solargraph socket from a terminal, I'd try setting solargraph.useBundler to false first. (To see if it works with bundler, run bundle exec solargraph socket instead.)

@spiffistan
Copy link
Author

I've tried all of the above with no luck (i.e. all possible option switches). Solargraph is listed in the Gemfile. AFAIK, the problem is the linkage against the system ruby, which should not happen. The terminal in VScode gives me the correct (RVM) ruby.

$ bundle exec solargraph socket
Solargraph is listening PORT=7658 PID=38184
$ solargraph socket
Solargraph is listening PORT=7658 PID=38194

VScode term:

$ which ruby
/Users/username/.rvm/rubies/ruby-2.5.1/bin/ruby

$ otool -L `which ruby` 	
/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1452.23.0)
/Users/username/.rvm/rubies/ruby-2.5.1/lib/libruby.2.5.dylib (compatibility version 2.5.0, current version 2.5.1)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.50.4)
/usr/local/opt/gmp/lib/libgmp.10.dylib (compatibility version 14.0.0, current version 14.2.0)
/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)

@spiffistan
Copy link
Author

To follow up here;

  • > process.env in the developer console gives me the correct path and environment (RVM rubies), yet solargraph still insists on using system ruby.
  • Other gems (rubocop, reek, ruby-lint) seem to work normally.
  • I've ran find . -type f | grep \.bundle | xargs otool -L in the current ruby to see if any gems were somehow linked with the system ruby, but none were.
  • I tried using solargraph in atom and the same problem seems to appear there.

@castwide
Copy link
Owner

Thanks for the details. I suspect this is an issue in the solargraph-utils library, which is responsible for selecting the appropriate shell to start the solargraph process. This is typically necessary, for example, in cases where the process explicitly needs to use bash or zsh for rvm to work.

One possibility: is VS Code running as a different user, such as root?

I'll run some tests on MacOS and look for other possible root causes.

@castwide
Copy link
Owner

One other possibility. Have you tried adding a .ruby-version file to the workspace root?

@spiffistan
Copy link
Author

It's running with my uid, not root.
I've had a .ruby-version and a .ruby-gemset in all the projects I've tried.

@castwide
Copy link
Owner

Okay, thanks. I still suspect the issue is with how solargraph-utils spawns the server process. I'll try to dig deeper on MacOS.

@wagenet
Copy link

wagenet commented Jul 19, 2018

I'm hitting this issue as well. If I wanted to try to fix it, where should I look?

@wagenet
Copy link

wagenet commented Jul 19, 2018

wagenet added a commit to wagenet/solargraph-utils that referenced this issue Jul 19, 2018
Not only does this appear to be unnecessary, it also prevents ENV vars from being inherited.
This is problematic especially in the case where RVM is being used.

Fixes castwide/vscode-solargraph#63
@spiffistan
Copy link
Author

A bit late, but just to follow up, I just confirmed that it does indeed work when removing '-l' from shell args in node_modules/solargraph-utils/out/commands.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants