Giter Club home page Giter Club logo

Comments (33)

Altons avatar Altons commented on June 5, 2024 12

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.

castwide avatar castwide commented on June 5, 2024 10

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.

castwide avatar castwide commented on June 5, 2024 7

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.

thomthom avatar thomthom commented on June 5, 2024 3

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.

castwide avatar castwide commented on June 5, 2024 3

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

fabiancarlos avatar fabiancarlos commented on June 5, 2024 2

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.

garyking avatar garyking commented on June 5, 2024 1

Okay, so far so good.

from vscode-solargraph.

castwide avatar castwide commented on June 5, 2024 1

@thomthom EventMachine has an issue with Ruby 2.4 on Windows. More information and a possible workaround

from vscode-solargraph.

shanereddy avatar shanereddy commented on June 5, 2024 1

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

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.

castwide avatar castwide commented on June 5, 2024

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.

arnaldo2792 avatar arnaldo2792 commented on June 5, 2024
  • 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.

arnaldo2792 avatar arnaldo2792 commented on June 5, 2024

which solargraph

/Users/agarrcia/.rvm/gems/ruby-2.4.1/bin/solargraph and my current ruby version is 2.4.1

from vscode-solargraph.

arnaldo2792 avatar arnaldo2792 commented on June 5, 2024
[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.

castwide avatar castwide commented on June 5, 2024

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.

arnaldo2792 avatar arnaldo2792 commented on June 5, 2024

I tried that but same error

from vscode-solargraph.

arnaldo2792 avatar arnaldo2792 commented on June 5, 2024

process.env.SHELL returns /bin/false, is that correct?

from vscode-solargraph.

castwide avatar castwide commented on June 5, 2024

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.

arnaldo2792 avatar arnaldo2792 commented on June 5, 2024

Its part of the log:

[Extension Host] Error: spawn /bin/false ENOENT

And then in the Developer Tools:

process.env.SHELL

from vscode-solargraph.

arnaldo2792 avatar arnaldo2792 commented on June 5, 2024

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.

castwide avatar castwide commented on June 5, 2024

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.

garyking avatar garyking commented on June 5, 2024

I seem to get this error too, if my workspace has a Gemfile.

from vscode-solargraph.

castwide avatar castwide commented on June 5, 2024

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.

thomthom avatar thomthom commented on June 5, 2024

Hmm.... my issue appear to be with solargraph itself.... I get the same error message from the system terminal.

from vscode-solargraph.

bgmat avatar bgmat commented on June 5, 2024

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.

bgmat avatar bgmat commented on June 5, 2024

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

castwide avatar castwide commented on June 5, 2024

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

bgmat avatar bgmat commented on June 5, 2024

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

castwide avatar castwide commented on June 5, 2024

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

strake7 avatar strake7 commented on June 5, 2024

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.

castwide avatar castwide commented on June 5, 2024

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.

IsolatePy avatar IsolatePy commented on June 5, 2024

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.

 avatar commented on June 5, 2024

This problem still persists in Flatpak using asdf-vm.

from vscode-solargraph.

gabo71096 avatar gabo71096 commented on June 5, 2024

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.

I was using the same setting as you, and installing the gem manually did the job, thanks!

from vscode-solargraph.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.