Could not find 'ruby-debug-ide' in VS Code - ruby-on-rails

I am trying to use VS Code for debugging a Ruby on Rails application. I have installed both the Ruby and Rubocop extension into VS Code. Then I have installed ruby-debug-ide -v 0.6.0 and debase -v 0.2.1 both via sudo gem install and rvmsudo gem install. However, when trying to debug the application using Rails server, I get the following exception:
/usr/lib/ruby/2.3.0/rubygems/dependency.rb:319:in `to_specs'
:
Could not find 'ruby-debug-ide' (>= 0.a) among 48 total gem(s)
(
Gem::LoadError
)
Checked in 'GEM_PATH=/home/myname/.rvm/gems/ruby-2.3.1:/home/myname/.rvm/gems/ruby-2.3.1#global', execute `gem env` for more information
from /usr/lib/ruby/2.3.0/rubygems/dependency.rb:328:in `to_spec'
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_gem.rb:65:in `gem'
from /usr/local/bin/rdebug-ide:22:in `<main>'
However, when I list all installed gems with rvm all do gem list, neither of the installed gems are there:
*** LOCAL GEMS ***
...
concurrent-ruby (1.0.2)
did_you_mean (1.0.0)
erubis (2.7.0)
...
rdoc (4.2.1)
rubygems-bundler (1.4.4)
rvm (1.11.3.9)
...
Does anybody know how to fix this?

In my case, the solution was quite simple. As a newbie in Ruby on Rails, I did not realize that instead of installing gems into Ruby root, I should specify them in my Gemfile. So, inside Gemfile I put only:
group :development do
gem 'ruby-debug-ide', '0.6.0'
gem 'debase', '0.2.1'
gem 'web-console', '~> 2.0'
gem 'spring'
end
and this solved the issue for me.

I also had this issue for a while, there doesn't seem to be a clear cut way of resolving this problem. All I had to do was run vs code through the terminal and I could debug my rails project, assuming you are using Linux. Just make sure you don't open vs code via a shortcut.

Related

install ruby on rails Mac os

hello guys i have checked all people sharing about installing ruby on rails but its the same problem
like this:
Fetching selenium-webdriver 3.4.3
Using listen 3.1.5
Using rails-dom-testing 2.0.3
Using globalid 0.4.0
Using activemodel 5.1.2
Using jbuilder 2.7.0
Using spring 2.0.2
Using rails-html-sanitizer 1.0.3
Using capybara 2.14.4
Bundler::GemspecError: Could not read gem at
/usr/local/lib/ruby/gems/2.4.0/cache/selenium-webdriver-
3.4.3.gem. It may be
corrupted.
An error occurred while installing selenium-webdriver (3.4.3), and
Bundler cannot continue.
Make sure that gem install selenium-webdriver -v '3.4.3' succeeds before
bundling.
In Gemfile:
selenium-webdriver
run bundle exec spring binstub --all
Could not find gem 'sass-rails (~> 5.0)' in any of the gem sources listed in your Gemfile.
Run bundle install to install missing gems.
I have experience with this driver, and downgraded to lower version here is the sample that work with my system, you can delete minitest incase you don't need it. I'm using rails 5.0.2
group :development, :test do
gem 'selenium-webdriver', '2.53.4'
gem 'minitest-rails-capybara'
gem 'minitest-reporters'
end
Bundler is trying to fetch the selenium-webdriverfrom its cache. Also, bundler suggests that the package is probably corrupt. You can try removing it from cache so bundler can install the gem again.
rm -f /usr/local/lib/ruby/gems/2.4.0/cache/selenium-webdriver-3.4.3.gem
bundle install

Rails console doesn't work (openshift)

I have been using openshift for a week now, and everything works fine. Unfortunately, neither with Ruby2.0 or Ruby1.9.3 can I access the Rails4 console online, which is a real problem.
bundle exec rails console RAILS_ENV="production"
fails, asking me to run bundle install, and bundle install fails, telling me it can't install active support 4.1.4, even though during deployment openshift says it is installed in .vendor/bundle. I tried deleted my app several times, recreating, starting with a clean version of the railsapp example on github... nothing works.
I hope you can help me, thanks in advance
[app-root/repo]$ bundle exec rails console RAILS_ENV="production"
bundler: command not found: rails
Install missing gem executables with `bundle install`
[app-root/repo]$ bundle install
Fetching gem metadata from https://rubygems.org/.........
Using rake (0.9.6)
Using i18n (0.6.11)
Using json (1.8.1)
Using minitest (5.4.0)
Using thread_safe (0.3.4)
Using tzinfo (1.2.1)
Installing activesupport (4.1.4)
Gem::InstallError: activesupport requires Ruby version >= 1.9.3.
An error occurred while installing activesupport (4.1.4), and Bundler
cannot continue.
Make sure that `gem install activesupport -v '4.1.4'` succeeds before
bundling.
[app-root/repo]$ gem install activesupport -v '4.1.4'
Fetching: i18n-0.6.11.gem (100%)
Successfully installed i18n-0.6.11
Fetching: thread_safe-0.3.4.gem (100%)
Successfully installed thread_safe-0.3.4
Fetching: tzinfo-1.2.2.gem (100%)
Successfully installed tzinfo-1.2.2
Fetching: activesupport-4.1.4.gem (100%)
Successfully installed activesupport-4.1.4
4 gems installed
[app-root/repo]$ bundle install
Fetching gem metadata from https://rubygems.org/.........
Using rake (0.9.6)
Using i18n (0.6.11)
Using json (1.8.1)
Using minitest (5.4.0)
Using thread_safe (0.3.4)
Using tzinfo (1.2.1)
Installing activesupport (4.1.4)
Gem::InstallError: activesupport requires Ruby version >= 1.9.3.
An error occurred while installing activesupport (4.1.4), and Bundler
cannot continue.
Make sure that `gem install activesupport -v '4.1.4'` succeeds before
bundling.
I am using the Gemfile provided on Github, with minor changes. I had to modify the following lines a bit, or rails would complain:
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring', group: :development
had to be replaced by
group :development do
gem 'spring'
end
group :doc do
gem 'sdoc', '~> 0.4.0'
end
Just ask if you need more info.
I use
cd ~/app-root/repo && RAILS_ENV=production bundle exec rails console
And it works fine for me.
OpenShift is quite picky with the Gemfile format:
In my case it was:
gem 'guard-rspec', require: false
Has to be:
gem 'guard-rspec', :require => false
That fixed the first error, bundle was complaining about the file format, and then I had the problem of the gems not being there.
So again I connected to the console and did a gem install bundler in
app-deployment/current/repo
and
~/.gem/bin/bundle exec rails c
did work this time

Conflict updating to Rails 3.1.10

I am currently running one of my Rails applications on version 3.1.3. My gemfile always listed:
gem 'rails', '3.1.3'
This worked just fine. In an effort to move to 3.1.10, I changed my Gemfile to the following:
gem 'rails', '~> 3.1.10'
Surprisingly, things break when I run bundle update rails after that change:
Bundler could not find compatible versions for gem "multi_json":
In Gemfile:
twitter (>= 0) ruby depends on
multi_json (~> 1.3) ruby
fnordmetric (>= 0) ruby depends on
multi_json (1.2.0)
Just as a test, I tried changing the gem version to '>= 3.1.0' and that installed without any quims, albeit it went to 3.2, which I'm not ready for just yet on this particular application.
Any suggestions for getting this thing running on 3.1.10 which was released today to address a security vulnerability?
Also an update:
I am having absolutely no trouble stashing Gemfile.lock away and starting from Rails 3.1.4. As soon as I try to go to 3.1.5+, this is where all the trouble begins.
Make the change in your Gemfile to
gem 'rails', '3.1.10'
Then try running
bundle update
instead of
bundle install
I can't see your Gemfile but this should will allow the bundler to try and find compatible Gem matches. If you have hard code a Gem revision you might have to relax it and repeat the update. Good luck!
Looking at the gems, it appears that oauth2 lists "multi_json ~> 1.0" and ActiveSupport 3.1.10 lists "multi_json < 1.3, >= 1.0" as the dependencies, so that should resolve. I've run into strangeness like this and fixed it by running
gem uninstall <relevant gems>
then running bundle install again. So maybe try
gem uninstall oauth2 multi_json activesupport
then bundle install
Edit
gem uninstall twitter multi_json fnordmetric

Rails 3 bundler updating

I have an application running on thin 1.2.11 behind nginx. I was trying to update my application to the latest version of it's gems using bundle update on a development machine, commiting to git, then running cap deploy. However, thin is giving me the following error:
/usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.14/lib/bundler/runtime.rb:31:in `block in setup': You have already activated rack 1.3.0, but your Gemfile requires rack 1.2.3. Consider using bundle exec. (Gem::LoadError)
On the server I have the following gems installed system wide:
bundler (1.0.14)
daemons (1.1.3)
eventmachine (0.12.10)
rack (1.3.0)
rake (0.9.2)
thin (1.2.11)
My Gemfile for my aplication:
source 'http://rubygems.org'
gem 'rails', '3.0.7'
gem 'sqlite3'
gem 'capistrano'
gem 'thin'
gem 'RedCloth'
gem 'will_paginate', '3.0.pre2'
gem 'jquery-rails'
I believe thin is requiring rack 1.3, while something in my Gemfile is requiring rack 1.2.3. Am I managing my gems the wrong way? What is the proper way to manage deployment and proper gem control?
I found using bundle exec thin start works, but I prefer a solution to allow me to use /etc/init.d/thin start.
Please read this: http://yehudakatz.com/2011/05/30/gem-versioning-and-bundler-doing-it-right/ before you tell us what you prefer.
Problem is you prefer to run command from gem installed into system to run application which has it's own dependencies (i.e. rack) specified in Gemfile. You can't have two version of same library loaded at the same time, so it's causing your problem with needing 'bundle exec' in from on every command.
Just do bundle exec at start of your cap scripts and he will pickup gems from bundler.
Often I have same problem if i have in system / currently used gemset newer versions of some gems.
i even have alias called be in shell for bundle exec. New versions of rvm do bundle exec automagicly also :).

Why is 'bundle update' installing ancient gems?

Everything was working just fine until, out of the blue, bundle update decided to 'update' to some very old versions of some gems. Any ideas? I'm baffled!
The Gemfile doesn't specify a version for the awry gems. eg.
gem 'rails'
I do...
bundle update
And(!)...
Using rails (0.9.5)
If I specify a version. eg.
gem 'rails', '~> 3.0'
Then it's ok.
Using rails (3.0.7)
Source 'http://rubygems.org'
Gem version 1.8.3, rvm version 1.6.14
Only some gems are wrong. mongoid is another. It's on 1.0.6. Thanks!
Problem solved. It was a gem conflict. I boiled it down to...
With just these two gems:
gem 'rails'
gem 'i18n'
You get i18n 0.6.0 (the latest) but rails is on 3.0.5 (3.0.7 is current latest).
And then with just these three:
gem 'rails'
gem 'i18n'
gem 'delayed_job'
You get:
Gems included by the bundle:
* actionmailer (0.6.1)
* actionpack (1.4.0)
* activerecord (1.6.0)
* activesupport (3.0.7)
* bundler (1.0.13)
* daemons (1.1.3)
* delayed_job (2.1.4)
* i18n (0.6.0)
* rails (0.9.5) <-- Yikes! that brings back memories!
* rake (0.9.0)
I've not looked deeper into how bundler's gem dependencies work yet, but that was what caused it. Interesting! And of course there's no need to include the i18n gem anyway, so removing that fixes things (or specifying gem versions).
Try this one.
Just update your bundler, May be of any-one of the older gem is conflicting with latest one, this type of issues arises.
'gem install bundler'
and then 'bundler install'
If you find again error, then delete GEM.lock file, then run bundler install. It may resolve the issue.

Resources