Closed arnaldo2792 closed 5 years ago
What OS are you using?
Did you change any of the solargraph
configuration options in VSCode?
Try opening VSCode's integrated terminal and running solargraph -v
. Do you get an error?
Does your project have a Gemfile?
Are you using a Ruby installation manager like rbenv or rvm? Solargraph uses your open workspace folder as its working directory, so whatever version of Ruby is configured to run in that directory needs to have the gem installed.
which solargraph
/Users/agarrcia/.rvm/gems/ruby-2.4.1/bin/solargraph
and my current ruby version is 2.4.1
Thanks. One other thing I forgot to ask, do you get any errors in the developer console? (Help -> Toggle Developer Tools)
Adding solargraph to the Gemfile shouldn't be necessary, but it might fix the problem.
Alternatively, you can try setting the solargraph.commandPath
option to /Users/agarrcia/.rvm/gems/ruby-2.4.1/bin/solargraph
.
[Extension Host] Error: spawn /bin/false ENOENT
at exports._errnoException (util.js:1050:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
at onErrorNT (internal/child_process.js:367:16)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickCallback (internal/process/next_tick.js:104:9)
[Extension Host] The Solargraph gem is not available.
Solargraph gem not found. Run `gem install solargraph` or update your Gemfile.
[Extension Host] rejected promise not handled within 1 second
And I tried to use /Users/agarrcia/.rvm/gems/ruby-2.4.1/bin/solargraph
but same error
The next thing I'd try is adding it to the Gemfile. If that works, it might indicate a bug. Solargraph shouldn't require it as long as the gem is in your path; it should just start without using the bundler.
I tried that but same error
process.env.SHELL
returns /bin/false
, is that correct?
That could be the problem. Solargraph will try to use your current shell or switch to bash
if it's not set. It typically needs to use bash
or zsh
for rvm to work.
Where did you go to check process.env.shell
? I have no idea how it would get set to /bin/false
.
Its part of the log:
[Extension Host] Error: spawn /bin/false ENOENT
And then in the Developer Tools:
process.env.SHELL
Okay, thanks. That shell is getting set upstream somewhere, but I might be able to fix the problem from the extension.
In the meantime, you might be able to work around it by starting VSCode by running code
on a command line so it uses the same shell as your terminal. You might need to enable it: https://code.visualstudio.com/docs/setup/mac#_launching-from-the-command-line
It's kind of weird, but my system preferences have /bin/false
instead of /bin/bash
and if I change it to /bin/bash
the Active Directory doesn't work (job's computer). But that's not a problem for the plugin, I think that this issue can be closed.
Thanks for the info. Based on a cursory Google search, it looks like /bin/false
is a valid shell under certain circumstances. I might need to make some changes to allow for it.
I seem to get this error too, if my workspace has a Gemfile.
Version 0.16.0 is published. It only attempts to use an explicit login shell when no other shell is specified or the shell is bash
or zsh
. For other shells like /bin/false
, it should default to the system environment.
Okay, so far so good.
I'm also seeing this. Windows 10, Ruby 2.4.
PS C:\Users\tthomas2\SourceTree\testup-2> solargraph -v
Unable to load the EventMachine C extension; To use the pure-ruby reactor, require 'em/pure_ruby'
Unable to load the EventMachine C extension; To use the pure-ruby reactor, require 'em/pure_ruby'
C:/Ruby24/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:120:in `require': cannot load such file -- 2.4/rubyeventmachine (LoadError)
from C:/Ruby24/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:120:in `require'
from C:/Ruby24/lib/ruby/gems/2.4.0/gems/eventmachine-1.2.5-x86-mingw32/lib/rubyeventmachine.rb:2:in `<top (required)>'
from C:/Ruby24/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:133:in `require'
from C:/Ruby24/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:133:in `rescue in require'
from C:/Ruby24/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:39:in `require'
from C:/Ruby24/lib/ruby/gems/2.4.0/gems/eventmachine-1.2.5-x86-mingw32/lib/eventmachine.rb:8:in `<top (required)>'
from C:/Ruby24/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:133:in `require'
from C:/Ruby24/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:133:in `rescue in require'
from C:/Ruby24/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:39:in `require'
from C:/Ruby24/lib/ruby/gems/2.4.0/gems/solargraph-0.19.1/lib/solargraph/shell.rb:6:in `<top (required)>'
from C:/Ruby24/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from C:/Ruby24/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from C:/Ruby24/lib/ruby/gems/2.4.0/gems/solargraph-0.19.1/bin/solargraph:5:in `<top (required)>'
from C:/Ruby24/bin/solargraph:23:in `load'
from C:/Ruby24/bin/solargraph:23:in `<main>'
Hmm.... my issue appear to be with solargraph itself.... I get the same error message from the system terminal.
@thomthom EventMachine has an issue with Ruby 2.4 on Windows. More information and a possible workaround
Hi I have tried all solutions suggested in this thread, but I still get this error:
Unable to load the EventMachine C extension; To use the pure-ruby reactor, require 'em/pure_ruby'
Unable to load the EventMachine C extension; To use the pure-ruby reactor, require 'em/pure_ruby'
C:/Ruby/Ruby24-x64/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:120:in `require': cannot load such file -- 2.4/rubyeventmachine (LoadError)
from C:/Ruby/Ruby24-x64/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:120:in `require'
from C:/Ruby/Ruby24-x64/lib/ruby/gems/2.4.0/gems/eventmachine-1.2.7-x64-mingw32/lib/rubyeventmachine.rb:2:in `<top (required)>'
from C:/Ruby/Ruby24-x64/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:133:in `require'
from C:/Ruby/Ruby24-x64/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:133:in `rescue in require'
from C:/Ruby/Ruby24-x64/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:40:in `require'
from C:/Ruby/Ruby24-x64/lib/ruby/gems/2.4.0/gems/eventmachine-1.2.7-x64-mingw32/lib/eventmachine.rb:8:in `<top (required)>'
from C:/Ruby/Ruby24-x64/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:133:in `require'
from C:/Ruby/Ruby24-x64/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:133:in `rescue in require'
from C:/Ruby/Ruby24-x64/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:40:in `require'
from C:/Ruby/Ruby24-x64/lib/ruby/gems/2.4.0/gems/solargraph-0.21.1/lib/solargraph/shell.rb:6:in `<top (required)>'
from C:/Ruby/Ruby24-x64/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from C:/Ruby/Ruby24-x64/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from C:/Ruby/Ruby24-x64/lib/ruby/gems/2.4.0/gems/solargraph-0.21.1/bin/solargraph:5:in `<top (required)>'
from C:/Ruby/Ruby24-x64/bin/solargraph:23:in `load'
from C:/Ruby/Ruby24-x64/bin/solargraph:23:in `<main>'
Also, I noticed that the latest gem version in 0.21, but the VS code extension shows 0.17.1 I this ok?
@bgmat The gem and extension versions are fine. (Extension 0.17.2 was released this morning, but it doesn't directly affect this issue.)
What OS and Ruby version are you using?
I fixed it on Windows 10 with these commands:
gem uninstall eventmachine
gem install eventmachine --platform ruby -- --use-system-libraries
@castwide I'm using Windows 7 and ruby 2.4.2p198 (2017-09-14 revision 59899) [x64-mingw32]
Installing eventmachine doesn't work for me with these params
d:\>gem install eventmachine --platform ruby -- --use-system-libraries
ERROR: While executing gem ... (Gem::UnsatisfiableDependencyError)
Unable to resolve dependency: No match for 'psych (= 3.0.2)' on this platform. Found: x64-mingw32
@bgmat Do you have DevKit installed?
The closest environment I've been able to confirm works is Windows 10 and Ruby 2.4.4. If the problem persists, I can try to troubleshoot it on a VM later.
@castwide I don't have DevKit. Is it a must have?
I installed Ruby 2.4.4-1 (RubyInstaller), then I run ridk install
to update MSYS2.
Same error ...
@bgmat As far as I know, DevKit is required in order to compile native dependencies. The other option would be pure Ruby versions of all the gems, which I'm not sure is possible.
2.4.4-1 is the version that worked for me on Windows 10. I'll try to troubleshoot on a Windows 7 VM when I can.
Experienced this issue in 2.5.1 in Windows 10 as well. @castwide 's suggestion worked for me with the flags mentioned.
gem uninstall eventmachine
gem install eventmachine --platform ruby -- --use-system-libraries
FIXED
starting vscode from terminal >code
sorted all out
I have a similar problem wiht "Solargraph gem not found". However the root of the issue is different according to Developer Tools:
[Extension Host] /bin/bash: solargraph: command not found
[Extension Host] Failed to start language server: "/bin/bash: solargraph: command not found\n"
I use zsh
and it is correctly configured in User Settings:
"terminal.integrated.shell.osx": "/bin/zsh"
I also use vscode-ruby
extension and have intellisense set to false so it uses solargraph:
"ruby.intellisense":false,
It seems like ext is looking for solargraph using bash which is unaware of rbenv instead of zsh. I can see the gem installed correctly from integrated terminal and the correct ruby version.
OS: High Sierra
shell: zsh (Oh my zsh)
Ruby version: ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-darwin17]
Ruby path: /Users/anegron/.rbenv/shims/ruby
solargraph -v
0.23.5
I tried setting solargraph.commandPath
and that kicks off solargraph but it generates a bunch of errors as it is trying to find gems such as rubocop, reek, fasterer in the ruby system version.....
Is there a way to force vscode-solargraph to use zsh???
Thanks
FIXED starting vscode from terminal
>code
sorted all outI have a similar problem wiht "Solargraph gem not found". However the root of the issue is different according to Developer Tools:
[Extension Host] /bin/bash: solargraph: command not found [Extension Host] Failed to start language server: "/bin/bash: solargraph: command not found\n"
I use
zsh
and it is correctly configured in User Settings:"terminal.integrated.shell.osx": "/bin/zsh"
I also use
vscode-ruby
extension and have intellisense set to false so it uses solargraph:"ruby.intellisense":false,
It seems like ext is looking for solargraph using bash which is unaware of rbenv instead of zsh. I can see the gem installed correctly from integrated terminal and the correct ruby version.
OS: High Sierra shell: zsh (Oh my zsh) Ruby version: ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-darwin17] Ruby path: /Users/anegron/.rbenv/shims/ruby solargraph -v 0.23.5
I tried setting
solargraph.commandPath
and that kicks off solargraph but it generates a bunch of errors as it is trying to find gems such as rubocop, reek, fasterer in the ruby system version.....Is there a way to force vscode-solargraph to use zsh???
Thanks
I can confirm that starting vscode via code
in the terminal then fixes this issue. I am also using zsh as my integrated terminal
As of extension version 0.19.0, issues with zsh
should be resolved.
If anyone still has problems, please feel free to open a new issue. Possibly related: #74
I found the solution you should gem install solargraph If not work and get this error ERROR: Loading command: install (ArgumentError) unknown encoding name - CP720 ERROR: While executing gem ... (NoMethodError) undefined method invoke_with_build_args' for nil:NilClass
Try to execute by administrator in CMD chcp 1252
Then try to install gem again
Enjoy!
This problem still persists in Flatpak using asdf-vm.
In my case, i use a Macbook and Rbenv to install dependencies. Than, when i set the global version, like rbenv global <version>
of ruby that i was using, and instaled solargraph manually, with gem install solargraph
, than closed VS code, and opened again.
In my case, i use a Macbook and Rbenv to install dependencies. Than, when i set the global version, like
rbenv global <version>
of ruby that i was using, and instaled solargraph manually, withgem install solargraph
, than closed VS code, and opened again.
I was using the same setting as you, and installing the gem manually did the job, thanks!
With yesterday's update, I'm getting this error:
Solargraph gem not found. Run
gem install solargraph
or update your Gemfile.I have solargraph installed as a global gem, so I don't understand why I'm having this error. When I click on
Install Now
nothing happens.