I just started learning Ruby and was setting up VSCode for working with it, when I ran into a bit of a weird situation with the Solargraph extension. I installed solargraph via gem install solargraph and everything seemed to go through, no errors.
However, after installing the extension itself in VSCode I get the following errors
"Solargraph not found. Run gem install solargraph or update your Gemfile."
As well as
"Couldn't start Ruby Language Server".
Moreover, when I enter the command solargraph -v I get an error saying solargraph can't be found.
I'm not really familiar at all with how Ruby or gems work, so I'm kinda lost. How can it not be found when it gets installed without a problem?
I use macOS if that's relevant.
Related
I was running into an issue with bundler when using rbenv. I had switched from ruby 2.3.1 to 2.5.1 a while ago, but I noticed the following error when trying to run bundler inside of a shell script in an ansible task.
```
rbenv: bundle: command not found
The `bundle' command exists in these Ruby versions:
2.2.2
2.3.1
```
I saw some solutions to this where you had to install bundler when on a specific ruby version. However even uninstalling bundler and reinstalling it did not resolve the issue. It seemed due to some gem issue that I could not install bundler on specific ruby versions, thus reinstalling bundler did nothing for me.
However I did find a very manual solution to this.
I noticed how rbenv whence bundle specified that bundle was active in some ruby versions, but not others. I tracked down the portion of rbenv whence command to find out where it was looking and saw that it looked under the following path for each ruby version installed under rbenv: ~/.rbenv/versions/$VERSION/bin/
If you look under the path for the gem without bundler (for me this was ~/.rbenv/versions/2.5.1/bin/) you will notice that it is not there. However under other versions that whence can recognise you will see the executable is there (for me it was there under ~/.rbenv/versions/2.3.1/bin/bundle and ~/.rbenv/versions/2.3.1/bin/bundle).
So I copied the executable over from the working ruby version to the one that was broken. Then at the top of the file you will notice sha-bang is set to the other ruby version (for me this was #!/Users/myuser/.rbenv/versions/2.3.1/bin/ruby). Change the version path to the ruby version you want to fix and then it will all magically start working.
I would highly recommend that you run your ansible scripts in an environment without rbenv. In other words, it is preferable to be using vagrant or a VM to practice your scripts in.
If your project really needs rbenv, please use the ansible rbenv library to work with it, but running it on your host machine is a dangerous way to develop because it is not easily reversible.
Hope this helps!
I have updated RubyGems to the newest version, I'm running Ruby 2.2.3p173, but when I go into my Powershell and type gem install gosu like RubyGems says, I get this error:
ERROR: Error installing gosu:
invalid gem: package is corrupt, exception while verifying: undefined method `size' for nil:NilClass (NoMethodEr
ror) in C:/Ruby22-x64/lib/ruby/gems/2.2.0/cache/gosu-0.10.6-x64-mingw32.gem
I'm not working Rails, so I don't have a Gemfile to try to install through. I wanted to start playing with the library locally. Any advice to get it to install?
(I haven't been able to try on OSX because I left my laptop at work, and I won't be back in my office for a week, so right now, it's Win10 only for me.)
I posted in the GitHub bug forum about this, and downloading and manually installing the gem worked.
https://github.com/gosu/gosu/issues/319#issuecomment-193687898
On my new OSX Mavericks install, I wanted to give Rubymine a try and just can't get the debugger working (although i managed to get it working on Windows 7 with IntelliJ and the ruby plugin).
Here's what I did (XCode and commandline tools already installed):
homebrew install ruby
gem update --system
Then I installed Rubymine and opened some of my projects. Upon starting the debugger, rubymine tries to install dependencies:
Failed to Install Gems. Following gems were not installed:
/Applications/RubyMine.app/rb/gems/ruby-debug-ide-0.4.22.gem: Error
installing ruby-debug-ide-0.4.22.gem: ERROR: Failed to build gem
native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
mkrf_conf.rb Installing base gem You don't have write permissions for
the /Library/Ruby/Gems/2.0.0 directory.
/Library/Ruby/Site/2.0.0/rubygems/installer.rb:620:in
verify_gem_home'
/Library/Ruby/Site/2.0.0/rubygems/installer.rb:740:in
pre_install_checks'
/Library/Ruby/Site/2.0.0/rubygems/installer.rb:213:in install'
/Library/Ruby/Site/2.0.0/rubygems/request_set.rb:136:inblock in
install' /Library/Ruby/Site/2.0.0/rubygems/request_set.rb:120:in
each' /Library/Ruby/Site/2.0.0/rubygems/request_set.rb:120:in
install'
/Library/Ruby/Site/2.0.0/rubygems/dependency_installer.rb:389:in
install' mkrf_conf.rb:34:inrescue in ' mkrf_conf.rb:27:in ` ' rake
failed, exit code 1 Gem files will remain installed in /Volumes/OSX
DATA/Users/freakazoid/.gem/ruby/2.0.0/gems/ruby-debug-ide-0.4.22 for
inspection. Results logged to /Volumes/OSX
DATA/Users/freakazoid/.gem/ruby/2.0.0/extensions/universal-darwin-13/2.0.0/ruby-debug-ide-0.4.22/gem_make.out
/Applications/RubyMine.app/rb/gems/debase-0.0.9.gem: Error installing
debase-0.0.9.gem: ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
extconf.rb
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby:
invalid option -D (-h will show valid options) (RuntimeError) extconf
failed, exit code 1 Gem files will remain installed in /Volumes/OSX
DATA/Users/freakazoid/.gem/ruby/2.0.0/gems/debase-0.0.9 for
inspection. Results logged to /Volumes/OSX
DATA/Users/freakazoid/.gem/ruby/2.0.0/extensions/universal-darwin-13/2.0.0/debase-0.0.9/gem_make.out
I can without problems do a
gem install debugger
on my osx terminal
Any help out there?
You need to get the source files since they aren't included.
gem install debugger-ruby_core_source
Then try again.
Also, since I've found this sometimes isn't set correctly in Rubymine, in the menu bar go to "Rubymine" -> "preferences" -> "Ruby SDK and Gems" and make sure it is pointed to the version of Ruby you are expecting.
Thanks Beartech, you pointed me to the right direction:
Rubymine was looking for ruby in "/Library/..../ruby" and homebrew of course had ruby installed to another location. I had to edit my rubymine settings and point the ruby sdk to homebrew's ruby. Then i had to restart rubymine in order to successfully use the new sdk location. (I had previousl not restartet rubymine ...)
I've recently installed the latest version of RubyMine, along with Ruby 1.9.3-- that's the version we're on at work.
When I open RubyMine and try to set the SDK to 1.9.3 I'm prompted to update some gems, but then receive errors I can't figure out what to do with. Would anyone know what's going on here and what I can do to fix it? (I do have the latest version of DevKit installed, and in my path.)
mini_magick (3.6.0): While executing gem ... (Errno::EINVAL) Invalid argument - C:/Ruby193/lib/ruby/gems/1.9.1/gems/mini_magick-3.6.0/test/files/special! "chars'.gif diff-lcs (1.2.4):
Error installing diff-lcs: "htmldiff" from diff-lcs conflicts with C:/Ruby193/bin/htmldiff bson (2.0.0.rc1):
Error installing bson: Building native extensions. This could take a while... ERROR: Failed to build gem native extension. C:/Ruby193/bin/ruby.exe extconf.rb
..there are about four more errors for various other gems.
I have Ruby and RubyMine working fine on another box, also on 1.9.3, but can't figure out what might be going on in this instance.
I got this working eventually, by doing removing gems by hand and re-adding them. Not really sure what the final, victorious, step was but doing the previous often enough got all the gems added properly.
I installed ruby through the windows installer yesterday.
All seemed fine.
Today, I went installing the rmagick win32 gem like so:
c:\ruby187\bin\gem install rmagick-2.7.1-x86-mswin32.gem
in the directory with the gem.
That also seemed to work fine, got the familiar
1 gem installed
Installing ...[all the ri and other docs].
But after that, I am tried:
c:\ruby187\bin\gem install --version '= 2.3.5' rails
it just returned immediately with no output. Probably doing nothing.
c:\ruby187\bin\gem list --local
the same, no output, but returns to the cmd line (no hang).
c:\ruby187\bin\gem install rails
c:\ruby187\bin\gem install --debug rails
c:\ruby187\bin\gem install --debug --version '= 2.3.5' rails
does exactly the same.
Any idea what's wrong?
I am a RoR newbie, although I already have some experience with it on linux -
but not on Windows.
Can anybody help? Really appreciated, started to get concerned now...
I've already had problems for installing rails on windows using the command gem install. The solution was executing the file cmd.exe like Administrator. This file is encountered in path C:\windows\system32 on Windows XP. Try do it.