vscode-ruby version: 0.16.0I have a gem project with rake dependency set to ~> 10.0. My Gemfile.lock currently looks like this:
remote: .
specs:
rubocop-sketchup (0.1.5)
rubocop (~> 0.51.0)
GEM
remote: https://rubygems.org/
specs:
ast (2.4.0)
diff-lcs (1.3)
parallel (1.12.1)
parser (2.5.0.2)
ast (~> 2.4.0)
powerpack (0.1.1)
rainbow (2.2.2)
rake
rake (10.5.0)
rspec (3.7.0)
rspec-core (~> 3.7.0)
rspec-expectations (~> 3.7.0)
rspec-mocks (~> 3.7.0)
rspec-core (3.7.1)
rspec-support (~> 3.7.0)
rspec-expectations (3.7.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.7.0)
rspec-mocks (3.7.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.7.0)
rspec-support (3.7.1)
rubocop (0.51.0)
parallel (~> 1.10)
parser (>= 2.3.3.1, < 3.0)
powerpack (~> 0.1)
rainbow (>= 2.2.2, < 3.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
ruby-progressbar (1.9.0)
unicode-display_width (1.3.0)
PLATFORMS
x64-mingw32
x86-mingw32
DEPENDENCIES
bundler (~> 1.13)
rake (~> 10.0)
rspec (~> 3.4)
rubocop-sketchup!
BUNDLED WITH
1.16.0
When I from a console run bundle exec rake or ruby bin/rake or ruby bin/rspec then everything is fine.
My launch.json looks like this:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Debug Local File",
"type": "Ruby",
"request": "launch",
"cwd": "${workspaceRoot}",
"program": "${workspaceRoot}/main.rb"
},
{
"name": "Listen for rdebug-ide",
"type": "Ruby",
"request": "attach",
"cwd": "${workspaceRoot}",
"remoteHost": "127.0.0.1",
"remotePort": "1234",
"remoteWorkspaceRoot": "${workspaceRoot}"
},
{
"name": "RSpec - all",
"type": "Ruby",
"request": "launch",
"cwd": "${workspaceRoot}",
"program": "${workspaceRoot}/bin/rspec",
"args": [
"-I",
"${workspaceRoot}"
]
},
{
"name": "RSpec - active spec file only",
"type": "Ruby",
"request": "launch",
"cwd": "${workspaceRoot}",
"program": "${workspaceRoot}/bin/rspec",
"args": [
"-I",
"${workspaceRoot}",
"${file}"
]
}
]
}
When I run gem list it show multiple rake versions available (because I have different projects);
rake (12.3.0, 10.5.0, default: 10.4.2)
I rely on bundler to correctly activate the correct set.
When I go to the Debug tab in VSCode and choose one of the RSpec configs, for instance "RSpec - active spec file only" it should execute the rspec tests while running the debugger.
When I try to debug this gem from VSCode I get an error:
Uncaught exception: You have already activated rake 12.3.0, but your Gemfile requires rake 10.5.0. Prepending `bundle exec` to your command may solve this.
C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/bundler/runtime.rb:313:in `check_for_activated_spec!'
C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/bundler/runtime.rb:31:in `block in setup'
C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/bundler/runtime.rb:26:in `map'
C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/bundler/runtime.rb:26:in `setup'
C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/bundler.rb:107:in `setup'
C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/bundler/setup.rb:20:in `<top (required)>'
C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:59:in `require'
C:/Ruby22-x64/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:59:in `require'
C:/Users/Thomas/SourceTree/rubocop-sketchup/bin/rspec:19:in `<top (required)>'
C:/Ruby22-x64/bin/rdebug-ide:23:in `load'
C:/Ruby22-x64/bin/rdebug-ide:23:in `<main>'
For some reason, when I execute bin/rspec from VSCode from a debugger task the newest rake version appear to already be activated when bundler tries to activate the older version specified by the Gemfile. I've tried stepping through the code and I cannot find what does that.
And it doesn't happen when I run the same command from the console.
Is there any chance that the extension is loading rake by itself - causing the latest rake version to be activated before the command in launch.js executes?
As things are now I need to temporarily uninstall any newer rake versions for working with project A, only to reinstall it when working with project B.
Is this still happening with 0.20.0?
same error. any reason why this was closed?
Uncaught exception: You have already activated rake 13.0.0, but your Gemfile requires rake 12.3.3. Prependingbundle execto your command may solve this.
my relevant launch setting:
{
"name": "rails_server",
"type": "Ruby",
"request": "launch",
"cwd": "${workspaceRoot}",
"env": {
"DEBUGGER": "true",
"DISABLE_SPRING": "true",
},
"program": "${workspaceRoot}/bin/rails",
"args": [
"server",
]
},
@r3dpointsp the extension doesn鈥檛 install any gems. My guess would be you鈥檙e using a gem with rake 13. I would try uninstalling the rake version you don鈥檛 want. That will probably surface what gem is using it.
It looks like ruby-debug-ide requires rake with no upper bound on the gem version. My guess would be when you installed that gem it brought the newest version of rake. You should be fine to just uninstall the version you don鈥檛 need.
still happening
rake aborted!
Gem::LoadError: You have already activated rake 13.0.1, but your Gemfile requires rake 12.3.3. Prepending `bundle exec` to your command may solve this.
/Users/dylan/Projects/friola/config/boot.rb:3:in `<top (required)>'
/Users/dylan/Projects/friola/config/application.rb:1:in `require_relative'
/Users/dylan/Projects/friola/config/application.rb:1:in `<top (required)>'
/Users/dylan/Projects/friola/Rakefile:4:in `require_relative'
/Users/dylan/Projects/friola/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)
Auto detecting rake tasks failed.
would like to know where the rake loaded
so we can prepend bundle exec !?
but why is this issue closed O_O!?
I had the same problem, happily uninstalling unwanted version helped.
I also don't understand why this issue is closed.
rake aborted!
Gem::LoadError: You have already activated rake 13.0.2, but your Gemfile requires rake 13.0.1. Prepending `bundle exec` to your command may solve this.
13.0.2 is the system-level rake installed by my package manager, 13.0.1 is the local version for this project installed by bundler.
Why should I have to uninstall the system rake?
I have "ruby.useBundler": true. The description for that setting is "Whether ruby tools should be started using Bundler". Sounds like exactly what should be needed, but it's not happening?
Most helpful comment
same error. any reason why this was closed?
Uncaught exception: You have already activated rake 13.0.0, but your Gemfile requires rake 12.3.3. Prependingbundle execto your command may solve this.my relevant launch setting: