Comments (33)
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
from vscode-solargraph.
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
.
from vscode-solargraph.
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
from vscode-solargraph.
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>'
from vscode-solargraph.
@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
from vscode-solargraph.
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.
from vscode-solargraph.
Okay, so far so good.
from vscode-solargraph.
@thomthom EventMachine has an issue with Ruby 2.4 on Windows. More information and a possible workaround
from vscode-solargraph.
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
from vscode-solargraph.
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.
from vscode-solargraph.
- What OS are you using?: MacOs
- Did you change any of the solargraph configuration options in VSCode?: No
- Try opening VSCode's integrated terminal and running solargraph -v. Do you get an error?: No
- Does your project have a Gemfile? Yes, do I have to add the gem to the 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.: Yes, and the gem is under that ruby's directory
from vscode-solargraph.
which solargraph
/Users/agarrcia/.rvm/gems/ruby-2.4.1/bin/solargraph
and my current ruby version is 2.4.1
from vscode-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
from vscode-solargraph.
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.
from vscode-solargraph.
I tried that but same error
from vscode-solargraph.
process.env.SHELL
returns /bin/false
, is that correct?
from vscode-solargraph.
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
.
from vscode-solargraph.
Its part of the log:
[Extension Host] Error: spawn /bin/false ENOENT
And then in the Developer Tools:
process.env.SHELL
from vscode-solargraph.
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.
from vscode-solargraph.
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.
from vscode-solargraph.
I seem to get this error too, if my workspace has a Gemfile.
from vscode-solargraph.
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.
from vscode-solargraph.
Hmm.... my issue appear to be with solargraph itself.... I get the same error message from the system terminal.
from vscode-solargraph.
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?
from vscode-solargraph.
@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
from vscode-solargraph.
@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.
from vscode-solargraph.
@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 ...
from vscode-solargraph.
@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.
from vscode-solargraph.
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
from vscode-solargraph.
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
from vscode-solargraph.
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!
from vscode-solargraph.
This problem still persists in Flatpak using asdf-vm.
from vscode-solargraph.
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!
from vscode-solargraph.
Related Issues (20)
- Error in diagnostics: RuboCop returned invalid data HOT 2
- Poll: is vscode-solargraph reliable/performant for medium-size Rails apps? HOT 2
- Rename Symbol Not Working
- autoformat in vs code deleting comments HOT 2
- Allow Setting the Port of externalServer to a String HOT 1
- Can not read properties of undefined HOT 2
- RuboCop --auto-correct is deprecated; use --autocorrect instead HOT 2
- Conflicting VS Code keybindings to search Ruby documentation HOT 1
- Document query was stuck in Rails project. HOT 1
- No Intellisense for Gems installed in custom home path HOT 1
- Completion menu only shows "Loading..." until I restart Solargraph HOT 3
- Request textDocument/documentHighlight failed. HOT 3
- Logging support unknown langId to enable trace setting
- solargraph not updating on changes HOT 1
- Logo in Visual Studio Marketplace HOT 3
- string arrays as default keyword arguments throws coloring off HOT 2
- It doesn't seem to be working: what theme should I use with Solargraph? HOT 1
- Request textDocument/definition failed when clicking on require HOT 2
- Compatibility with Ruby LSP?
- How to debug - An error occurred while building gem documentation HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vscode-solargraph.