Running into ruby version clash when trying to start the rails debugger inside of VS Code. Sorry if this is a stupid question.. I'm normally a Js guy, very new to Rails
Getting this error :
rake (>= 0.8.1)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
Uncaught exception: Your Ruby version is 2.3.7, but your Gemfile specified 2.3.1
/Library/Ruby/Gems/2.3.0/gems/bundler-1.17.3/lib/bundler/definition.rb:495:in `validate_ruby!'
/Library/Ruby/Gems/2.3.0/gems/bundler-1.17.3/lib/bundler/definition.rb:470:in `validate_runtime!'
.
.
.
When I type ruby --version in my console, I get ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin17]
Had this same issue.
Restarting the computer worked for me.
The vscode debugger console environment doesn't seem to update until a complete computer restart happens. Might be a bug or intentional.
Related
Thank you this community for getting me started on the right path. Specifying rails version to use when creating a new application gets me close, but the differing ruby version is what is throwing me off. I'm running into an error after running rails new that I'm not sure where to begin to resolve it. I gather from the error that my command is missing a parameter, but I can't determine what it is.
Any advice?
I would like to create a rails 5.2.6 project and I'm finding consistent responses elsewhere indicating that my approach to getting a rails project created with a specific version is to:
install the rails gem with gem install rails -v 5.2.6
create a new rails project, specifying the rails version with rails _5.2.6 new appName
I think I'm on to it. Did a specific google search for compatibility of Ruby 3 with Rails 5 and appears this is the likely problem.
I've now run 'rvm install 2.7.4' then 'rvm use 2.7.4' but still seems to be using ruby 3 in the command. The new error:
user#ubuntudev:~/railsprojects$ rails _5.2.6_ new rpapitest
/home/user/.rbenv/versions/3.0.0/lib/ruby/3.0.0/rubygems.rb:281:in `find_spec_for_exe': can't find gem railties (= 5.2.6) with executable rails (Gem::GemNotFoundException)
from /home/user/.rbenv/versions/3.0.0/lib/ruby/3.0.0/rubygems.rb:300:in `activate_bin_path'
from /home/user/.rbenv/versions/3.0.0/bin/rails:23:in `<main>'
Try with rbenv global 2.7.4 if you have rbenv installed
I create a rails project by rails new foo, then cd foo, and run rails c.
Then I got message like this.
DL is deprecated, please use Fiddle
Loading development environment (Rails 4.0.2)
Switch to inspect mode.
That's all. I can't use rails console.
Have you any idea what am I doing wrong?
I'm using railsinstaller with ruby 1.9.3 and 2.0.0 both, and ruby 2.0.0p451 (2014-02-24) [i386-mingw32] from Rubyinstaller. All versions fails with same error.
There is no problem with simple irb command.
Edit
By following Graeme's advice, I updated rb-readline from 0.5.0 to 0.5.1. and uninstalled old one.
$ gem list | grep rb-readline
rb-readline (0.5.1)
But the message remains same.
In case anyone gets this error with Docker, I got it because I ran docker run rails but needed -it.
> docker run rails
Switch to inspect mode. # fail
> docker run -it rails
irb(main):001:0> # yay
This is a known problem caused by the rb-readline gem in version 0.5.0. It has been subsequently fixed in 0.5.1 which came out a few months ago.
You should therefore upgrade the rb-readline gem to v0.5.1 to fix this problem.
You can see here more details about the issue and the resolution.
After upgrading a Rails application to use Ruby 2.0.0 (from 1.9.3), I started receiving this error when attempting to deploy to Heroku via rake <stage> deploy.
Your Ruby version is 1.9.3, but your Gemfile specified 2.0.0 (Bundler::RubyVersionMismatch)
It also seems to cause this error, (but I can run the Heroku commands manually without the heroku_san helpers, so authorization is not the issue).
Expected(200) <=> Actual(401 Unauthorized)
I updated the gems to the latest version, and also updated the Heroku Toolbelt.
I found this pull request and patched my version, but the error persisted.
How do I solve this (on both Ubuntu & OSX)?
Other info:
Ubuntu 12.04 LTS x64
Rails 3.2.13
Ruby 2.0.0-p247
heroku-api-0.3.15
heroku_san-4.0.8
heroku-toolbelt/2.41.0 (x86_64-linux)
rvm 1.22.10
The solution for me on Ubuntu was to modify
/usr/local/heroku/bin/heroku
And change the shebang line to
#!/usr/bin/env ruby
Thanks goes to Pivotal Labs for this.
(I don't use a Mac.)
Another issue I found with this error (1.9.2 not 1.9.3) is having BUNDLE_GEMFILE env variable set on heroku which causes heroku ruby build pack to freak and default to 1.9.2.
I've previously added ZenTest to my gemfile to get autotest to run. On this occasion I get the following error four times over:
saasbook#saasbook:~/Documents/github/LocalSupport$ bundle exec autotest
Invalid gemspec in [/usr/local/lib/ruby/gems/1.9.1/specifications/ZenTest-4.9.0.gemspec]: Illformed requirement ["< 2.1, >= 1.8"]
I've searched on this error and found a number of discussions in the github repo for ZenTest:
https://github.com/seattlerb/zentest/issues/29
https://github.com/seattlerb/zentest/issues/32
https://github.com/seattlerb/zentest/issues/33
I've followed some of the advice there, uninstalled and re-installing ZenTest, but no joy. I'm on ubuntu running ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux]
My entire app is available here:
https://github.com/tansaku/LocalSupport
so for example you can check out my GemFile:
https://github.com/tansaku/LocalSupport/blob/master/Gemfile
Any ideas?
Many thanks in advance
Just fixed this by editing
/usr/local/lib/ruby/gems/1.9.1/specifications/ZenTest-4.9.0.gemspec
so that the line specifying the rubygems version is now this:
s.required_rubygems_version = Gem::Requirement.new("< 2.1") if s.respond_to? :required_rubygems_version=
now everything runs fine ...
Upgrading rubygems and reinstalling the ZenTest (according to what Sam wrote) solved my problem but it causes me another problem:
/Users/neo/.rvm/gems/ruby-1.9.2-p320/gems/bundler-1.2.3/lib/bundler/rubygems_integration.rb:187:in `stub_source_index170': uninitialized constant Gem::SourceIndex (NameError)
Anything I want to do, from running the autotest to starting rails server, it gives me that error. After searching a bit I found this page.
It seems that the latest version of rubygems has some bugs, so you should not upgrade it to the latest version, instead upgrade it to a stabler version like 1.8.24 .
I made a change to my shell profile and now when I try to run the Rails console on a Rails app I created, I get this message:
Loading development environment (Rails 2.3.4)
Rails requires RubyGems >= 1.3.2 (you have 1.0.1). Please `gem update --system` and try again.
However, when I run gem -v the output is 1.3.5. What happened here, and how do I fix it? I already renamed the gems version (along with Ruby 1.8.6 and Rails 1.2.6) that came with Leopard to "gem.orig". I added a debug to the Rails initializer and for some reason require 'rubygems' is loading v1.0.1 and not the installed version? How do I fix this? It happened all of a sudden when I changed my shell and configuration.
You probably need to re-set RUBYOPT for the new shell. Details are in the Gems documentation.