I am receiving this error when trying to run rails server:
$ rails server
/usr/local/Cellar/ruby/1.9.3-p286/lib/ruby/1.9.1/rubygems.rb:317:in `bin_path': can't find gem rails ([">= 0"]) with executable rails (Gem::GemNotFoundException)
from /usr/local/bin/rails:19:in `<main>'
Why does 1.9.3 use 1.9.1 lib folder?
Thanks.
It uses 1.9.1 for compatibility and historical packing reasons. Given the change is only in minor numbers, everything just works. IMO this folder could be called just ../ruby/1.9.
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
The Ruby on Rails Tutorial by Michael Hartl uses a Gemfile without specifying a Ruby version: the ruby keyword is missing in all the applications.
When I deploy to Heroku I receive the following warning:
remote: ###### WARNING:
remote: You have not declared a Ruby version in your Gemfile.
remote: To set your Ruby version add this line to your Gemfile:
remote: ruby '2.2.4'
remote: # See https://devcenter.heroku.com/articles/ruby-versions for more information.
The tutorial says that "the costs associated with including such an explicit Ruby version number outweigh the (negligible) benefits, so you should ignore this warning for now. The main issue is that keeping your sample app and system in sync with the latest Ruby version can be a huge inconvenience".
I am wondering whether the alternative is to keep the pace with the Ruby version at Heroku (presumably 2.2.4 at present), as the book seems to suggest, or also to specify any Ruby version it suits me. In other words, since I am using Ruby 2.2.1p85 for my application, adding ruby "2.2.1", :patchlevel => "85" would work and make Heroku adjust to this version or rather I am supposed to adjust to Heroku and add as suggested ruby '2.2.4'?
I am using rvm and a specific gemset with a specific Ruby version, for no other reason than trying to use an environment as much close to the tutorial as possible. What is the best practice in a real context? Would you suggest to use the last Ruby version and include it in the Gemfile? Can the Gemfile leave out the Ruby version with no worries?
Please follow the steps to solve
You can check which ruby version is associate with your app by command
heroku run "ruby -v"
It is good to have default version of ruby which is 2.2.4 in order to solve your problem. If your ruby version is older than 2.2.4 then please upgrade it.
after checking/upgrading version You can use the ruby keyword in your app’s Gemfile to specify a particular version of Ruby.
source "https://rubygems.org"
ruby "2.2.4"
You will need to install and update bundler again
$ gem install bundler
$ bundle update
This command:
heroku run rake db:migrate
solved same problem
I am trying to run https://github.com/netguru/people but keep getting issues. When I push it to heroku i get errors, when I copied the files to my projects folder and run 'rails server' I get rails server
Your Ruby version is 2.1.1, but your Gemfile specified 2.0.0
I updated the ruby version in gem file but still run into issues.
Any help would be appreciated. Running Mac OSX Mavericks
I believe you've got your answer here https://github.com/netguru/people/issues/3
try to do:
gem install bundler rails
and then just do
bundle
I am trying to set my machine up so I can follow this tutorial: the intro to rails screen-cast i wish i had.
I keep running into issues, most recently the following:
C:/Ruby192/lib/ruby/gems/1.9.1/gems/ansi-1.4.1/lib/ansi/code.rb:5:in `require':
no such file to load -- Win32/Console/ANSI (LoadError)
This occurs when ever I run rails g. (I would like to see if my r spec generator has been added.)
Environment details: Windows 7, ruby 1.9.2p290, rails 3.1.1, rubygems 1.8.15
After you installed "gem install win32console", can you add this gem into your Gemfile file and try to run bundle install again?
Gemfile
gem "win32console", "~> 1.3.0"
RailsInstaller may be your best bet if you're looking for an integrated Windows Rails experience.
It's up-to-date (-ish, doesn't use Ruby 1.9.3) with:
Ruby 1.9.2-p290
Rails 3.1.1
Git 1.7.6
and other useful bits.
I used RVM to upgrade Ruby 1.9.2 from patch level p180 to p290:
rvm upgrade 1.9.2-p180 1.9.2-p290
Then, I used these commands to update my Rails gem and other gems
gem install rails 3.0.5
gem update
Everything seems to be fine; rvm info shows all Ruby binaries and gems have been moved to the correct p290 path (~/.rvm/*/ruby-1.9.2-p290/*).
However, when I go to my Rails application directory and issue the command rails console, I get the error message saying a gem (activesupport-3.0.5) cannot load the libruby.1.9.1.dylib file.
10:30 AM ~/Development/rails_projects/my_app_0515 $ rails console
/Users/whk/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:in `require': dlopen(/Users/whk/.rvm/gems/ruby-1.9.2-p290/gems/serialport-1.0.4/lib/serialport.bundle, 9): Library not loaded: /Users/whk/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.1.9.1.dylib (LoadError)
Referenced from: /Users/whk/.rvm/gems/ruby-1.9.2-p290/gems/serialport-1.0.4/lib/serialport.bundle
Reason: image not found - /Users/whk/.rvm/gems/ruby-1.9.2-p290/gems/serialport-1.0.4/lib/serialport.bundle
. . .
Rails can't find the dylib file in ~/.rvm/rubies/ruby-1.9.2-p180/lib, because the p180 path no longer exists, but the file is in ~/.rvm/rubies/ruby-1.9.2-p290/lib.
From a separate StackOverflow post, I found a workaround is adding this line to .bashrc
export DYLD_LIBRARY_PATH="/Users/whk/.rvm/rubies/ruby-1.9.2-p290/lib:$DYLD_LIBRARY_PATH"
However, I want to understand why the rvm ruby upgrade doesn't take care of the lib path change? Does anyone know a cleaner solution -- one that removes the p180 path from where it is configured?
Here are my environment:
Mac OS X 10.6.6 (Snow Leopard)
rvm 1.8.4
ruby 1.9.2p290
Rails 3.0.5
Thanks!
the problem was in gems native extension - their were nto rebuild during rvm upgrade 1.9.2-p180 1.9.2-p290 - next time please have closer look on the output ... it should give your information what's wrong.
as for this particular use case it shoudl be enough to reinstall the given gem:
gem install serialport -v 1.0.4
... not sure if it should be uninstalled first