I am currently trying to start my rails server after doing a bundle install. However, when I try to do rails s, this error pops up
Could not find gem 'byebug (= 9.0.6)' in any of the gem sources listed in your Gemfile. Run bundle install to install missing gems.
I then run bundle install but the same error pops up. I've also tried getting rid of byebug in the gemfile but it just gives me the same error but with a different gem. I've tried installing byebug individually using gem install byebug -v 9.0.6 but the same problem persists.
This is my gemfile
source 'https://rubygems.org'
gem 'rails', '5.1.6'
gem 'puma', '3.9.1'
gem 'sass-rails', '5.0.6'
gem 'uglifier', '3.2.0'
gem 'coffee-rails', '4.2.2'
gem 'jquery-rails', '4.3.1'
gem 'turbolinks', '5.0.1'
gem 'jbuilder', '2.7.0'
group :development, :test do
gem 'sqlite3', '1.3.12'
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', '9.0.6', platform: :mri
end
group :development do
gem 'web-console', '3.5.1'
gem 'listen', '3.1.5'
gem 'spring', '2.0.2'
gem 'spring-watcher-listen', '2.0.1'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
You should run your rails server with bundle exec rails s to be in the context of the bundle.
In my case, there was a following line in .bundle/config
BUNDLE_WITHOUT: "test:development"
After removing that line and running bundle install, everything works fine.
Related
I am attempting to install kaminari, but Rails cannot find it or a dependency (I've run into both - currently dependency):
∴ bundle exec rails g kaminari:config
Could not find i18n-1.8.4 in any of the sources
Run `bundle install` to install missing gems.
This is despite it being installed:
∴ bundle info i18n
The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.
* i18n (1.8.4)
Summary: New wave Internationalization support for Ruby
Homepage: https://github.com/ruby-i18n/i18n
Path: /Users/shawn/.rvm/gems/ruby-2.6.3#refstats/gems/i18n-1.8.4
I first attempted to delete Gemfile.lock. Same result. Then I deleted the refstats gemset and recreated it. Same result. Then I tried bundle install --force and got same result.
I've tried both gem 'kaminari', '~> 1.2' and gem 'kaminari' in my Gemfile.
Any suggestions?
EDIT:
Gemfile:
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '2.6.3'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 6.0.3', '>= 6.0.3.2'
# Use sqlite3 as the database for Active Record
#gem 'sqlite3', '~> 1.4'
gem 'pg'
# Use Puma as the app server
gem 'puma', '~> 4.1'
# Use SCSS for stylesheets
gem 'sass-rails', '>= 6'
# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
gem 'webpacker', '~> 4.0'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.7'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use Active Model has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Active Storage variant
# gem 'image_processing', '~> 1.2'
gem 'devise', '~> 4'
gem 'kaminari'
# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.4.2', require: false
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
end
group :development do
# Access an interactive console on exception pages or by calling 'console' anywhere in the code.
gem 'web-console', '>= 3.3.0'
gem 'listen', '~> 3.2'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end
group :test do
# Adds support for Capybara system testing and selenium driver
gem 'capybara', '>= 2.15'
gem 'selenium-webdriver'
# Easy installation and use of web drivers to run system tests with browsers
gem 'webdrivers'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
Edit 2:
∴ cat .ruby-version
ruby-2.6.3
I have no .ruby-gemset, but my console is reporting I'm using the right one:
12:36:50 shawn#macbook-pro:~/Documents/uga/refstats (git:master:547a0b4) ruby-2.6.3#refstats
∴
EDIT 3:
Well, the gremlin has disappeared, though I cannot say why. This is what I did:
1) Created new test rails app
2) Bundle install in new gemset
3) Added kaminari to Gemfile
4) Bundle install
5) Generated kaminari config successfully
6) Switch to non-working app, but forget to switch gemset, putting me in rvm with no gemset. Don't notice.
7) Bundle install
8) Notice things get installed, including kaminari. Notice I'm on wrong gemset.
9) Switch to correct gemset.
10) Bundle install (which installs nothing)
11) Generate kaminari config successfully
I really cannot say why it started working, unless installing to the rvm root had some effect. But that's what I did, and it's all working now. Thanks for the time.
Just because the gem is installed on your machine does not mean it is part of your bundle. bundle exec scopes the available gems to only what is included in your Gemfile and those gems dependencies. See if i18n for that version shows up when you run bundle show.
I was working on a project earlier today when suddenly my rails commands stopped working. I know that I must have introduced something that created an error but for the life of me I don't know what. The error that I get whenever I type any rails commands (for example, rails c, rails s, rails -v etc) is the following:
Traceback (most recent call last):
1: from /Users/mccoleman/.rvm/gems/ruby-2.5.1/bin/rails:23:in `<main>'
/Users/mccoleman/.rvm/gems/ruby-2.5.1/bin/rails:23:in `load': cannot load such file -- /Users/mccoleman/.rvm/rubies/ruby-2.5.1/lib/ruby/gems/2.5.0/gems/railties-5.2.3/exe/rails (LoadError)
The following is my gemfile:
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '2.5.1'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.2.2', '>= 5.2.2.1'
# Use postgresql as the database for Active Record
gem 'pg', '>= 0.18', '< 2.0'
# Use Puma as the app server
gem 'puma', '~> 3.11'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
# gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use ActiveStorage variant
# gem 'mini_magick', '~> 4.8'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.1.0', require: false
gem 'rspec'
# Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin AJAX possible
# gem 'rack-cors'
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
end
group :development do
gem 'listen', '>= 3.0.5', '< 3.2'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
gem 'rb-readline'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
I've tried searching for similar errors but haven't been able to find anything that looks similar. Any ideas why rails suddenly isn't working?
Take a look at RVM's gemset. Set a gemset for your project, use it, install and run bundle.
$ cd myproject
$ rvm create gemset mygemset
$ cat 'mygemset' > .ruby-gemset
$ cat 'ruby-2.5.1' > .ruby-version
$ cd .
$ gem install bundle
$ bundle
.ruby-version and .ruby-gemset allow RVM to set your Ruby version and gemset automatically when you cd to you project.
While I'm still not 100% sure what caused the error to occur, I was able to rectify it by uninstalling and then reinstalling rails.
I have searched or similar problems , but none of the solutions worked for me .
I will describe the problem in details:
The server works as normal when i create a new rails app , our instructor have told us to replace the existing gem file with another -shown below- and run bundle or bundle update to resolve the gems
source 'https://rubygems.org'
gem 'rails', '4.2.3'
gem 'sqlite3'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'therubyracer', platforms: :ruby
gem 'capybara', '~> 2.4.4'
gem 'poltergeist', '~> 1.6.0'
gem 'phantomjs', '~> 1.9.8.0'
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0', group: :development
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
gem 'spring'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
gem 'httparty'
The problem appear when I do replace the existing gem file with the new one ,the server don't work and here is my command line logs.
if you need any further information, leave a comment.
edit: more info >>>rails version installed 5.0.1
I have found a solution for the problem , and I want to leave it here ,so anyone have the same problem could use .
The problem was that I had rails v5.0.1 installed , and that caused problems related to comparability with other gems , so I downgraded my rails to 4.2.3
1-first you need to run gem uninstall rails ,and gem uninstall railties
2-now , go ahead and install rails again ,you could search for rails 4.2.3 to download and install it or you could do this through the command , I'm working on windows and I don't know how the command looks on others ,but I believe it's something similar , you could try this gem install rails '4.2.3' and that it!
I was first developing my RoR application in Windows. Now since I've been founding a few problems regarding some gems, SSH and stuff I decided to move to Linux. I am trying to initate the application, but It seems I am not able to.
When I do bundle update rails I got the following error:
Could not find gem 'rails (= 4.2.4) x64-mingw32' in the gems available on this
machine.
This is my tzinfo-data gem:
gem 'tzinfo-data', platforms: [:mingw, :mswin, :jruby]
But I have already tried with this one too:
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
Any idea? Because when I just do bundle install I also got the following error:
You have requested:
rails = 4.2.4
The bundle currently has rails locked at 4.2.4.
Try running `bundle update rails`
Update:
Gemfile content
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.4'
# Use postgresql as the database for Active Record
gem 'pg'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
gem 'bootstrap-sass', '~> 3.2.0'
gem 'autoprefixer-rails'
gem 'devise'
gem 'bootstrap_form'
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Use ActiveModel has_secure_password
gem "bcrypt-ruby", '~> 3.0.0'
gem 'google-api-client', '0.9'
gem 'letsrate'
gem 'will_paginate', '~> 3.0.6'
gem 'filterrific'
#gem 'ratyrate'
# Use Unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :jruby]
If you’ve installed Rails using bundler and rubygems, make sure you have the latest version in your Gemfile:
rails '4.2.4'
there is Gemfile.lock which locks the version. You delete that and run again bundle install. it will work.
bundle install
Visit https://rubygems.org/gems
Search for your gem. Once found, copy the text from the box titled GEMFILE
Add the copied text in your Gemfile found inside your app
Run bundlefrom the console opened at the root of your app.
On successful installation of the gems your console will display the message:
Bundle complete! xx Gemfile dependencies, xx gems now installed.
I've been developing a (very simple) Rails project and have moved the files to a new machine. I have Ruby (version 2.0.0p195) and Rails (4.0.0) installed.
From the C:\Sites directory in command prompt (console), when I type 'rails server' I get a whole bunch of information that starts with:
Usage:
rails new APP_PATH [options]
...
...and continues with Options:, Runtime options:, Rails options: and so on.
When I cd to the directory of my copied project:
C:\Sites\elearning
and try 'rails server' I get the following error:
'mri_21' is not a valid platform. The available options are: [:ruby, :ruby_18, :ruby_19, :ruby_20, :mri, :mri_18, :mri_19, :mri_20, :rbx, :jruby, :mswim, :mingw, :mingw_18, :mingw_19, :mingw_20]
Does anyone know what I'm doing wrong? Is it possible to copy a rails project from another computer? And if so, how would I do that?
Any help, much appreciated.
Edit:
FYI, my gemfile is as follows:
source 'https://rubygems.org'
ruby '2.1.2'
gem 'rails', '4.1.5'
gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'spring', group: :development
gem 'bootstrap-sass'
gem 'devise'
gem 'sqlite3'
gem 'thin'
group :development do
gem 'better_errors'
gem 'binding_of_caller', :platforms=>[:mri_21]
gem 'quiet_assets'
gem 'rails_layout'
gem 'byebug'
end
For those trying to transfer a mac project to PC: I've finally got rails server running.
First, in the gem file, I changed the reference 'mri_21' to 'mri_20' and changed the ruby version number to match my version of ruby.
I had other errors, but the short story is that I created a new rails project, copied MOST of the old project files into the corresponding files of the new project and EVENTUALLY noticed the comment at the bottom of the new (freshly created) routes.rb file:
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
So I added:
gem 'tzinfo-data', platforms: [:mingw, :mswin]
and all is, for now, right with the world.
So, if you're transferring a mac project to PC, you'll need to add the tzinfo-data gem to your gemfile.
Try running "gem update bundler" and see if that works.