Specified 'mysql2' for database adapter, but the gem is not loaded - ruby-on-rails

I know this question is asked many times. I also tried all the things written on internet to fix it but I cannot.
When I run rails generate controller command, I get this error in my command line. By the way, I used to get this error in the browser but I created project with 4.2.2, instead of 4.2.4, and I don't get this error in browser.
This is Gemfile.
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.2'
# Use mysql as the database for Active Record
gem 'mysql2', '~> 0.3.18'
# 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
# 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
# Twitter's Bootstrap, converted to Sass and ready to drop into Rails or Compass
gem 'bootstrap-sass', '~> 3.3.5.1'
# Use ActiveModel has_secure_password
gem 'bcrypt', '~> 3.1.7'
# 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'
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
Bundle install:
Using rake 10.4.2
Using i18n 0.7.0
Using json 1.8.3
Using minitest 5.8.1
Using thread_safe 0.3.5
Using tzinfo 1.2.2
Using activesupport 4.2.2
Using builder 3.2.2
Using erubis 2.7.0
Using mini_portile 0.6.2
Using nokogiri 1.6.6.2
Using rails-deprecated_sanitizer 1.0.3
Using rails-dom-testing 1.0.7
Using loofah 2.0.3
Using rails-html-sanitizer 1.0.2
Using actionview 4.2.2
Using rack 1.6.4
Using rack-test 0.6.3
Using actionpack 4.2.2
Using globalid 0.3.6
Using activejob 4.2.2
Using mime-types 2.6.2
Using mail 2.6.3
Using actionmailer 4.2.2
Using activemodel 4.2.2
Using arel 6.0.3
Using activerecord 4.2.2
Using execjs 2.6.0
Using autoprefixer-rails 6.0.3
Using bcrypt 3.1.10
Using debug_inspector 0.0.2
Using binding_of_caller 0.7.2
Using sass 3.4.18
Using bootstrap-sass 3.3.5.1
Using byebug 6.0.2
Using coffee-script-source 1.9.1.1
Using coffee-script 2.4.1
Using thor 0.19.1
Using railties 4.2.2
Using coffee-rails 4.1.0
Using multi_json 1.11.2
Using jbuilder 2.3.1
Using jquery-rails 4.0.5
Using mysql2 0.3.20
Using bundler 1.10.6
Using sprockets 3.3.5
Using sprockets-rails 2.3.3
Using rails 4.2.2
Using rdoc 4.2.0
Using tilt 2.0.1
Using sass-rails 5.0.4
Using sdoc 0.4.1
Using spring 1.4.0
Using turbolinks 2.5.3
Using uglifier 2.7.2
Using web-console 2.2.1
Bundle complete! 14 Gemfile dependencies, 56 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.
What should I do? Thank you.
EDIT:
I did try: gem 'mysql2', '~> 0.3.18' but doesn't work.
EDIT (ERROR)
I changed my username with ...
/Users/.../.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.2/lib/active_record/connection_adapters/connection_specification.rb:177:in `rescue in spec': Specified 'mysql2' for database adapter, but the gem is not loaded. Add `gem 'mysql2'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord). (Gem::LoadError)
from /Users/.../.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.2/lib/active_record/connection_adapters/connection_specification.rb:174:in `spec'
from /Users/.../.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.2/lib/active_record/connection_handling.rb:50:in `establish_connection'
from /Users/.../.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.2/lib/active_record/railtie.rb:120:in `block (2 levels) in <class:Railtie>'
from /Users/.../.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.2/lib/active_support/lazy_load_hooks.rb:38:in `instance_eval'
from /Users/.../.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.2/lib/active_support/lazy_load_hooks.rb:38:in `execute_hook'
from /Users/.../.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.2/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'
from /Users/.../.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.2/lib/active_support/lazy_load_hooks.rb:44:in `each'
from /Users/.../.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.2/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'
from /Users/.../.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.2/lib/active_record/base.rb:316:in `<module:ActiveRecord>'
from /Users/.../.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.2/lib/active_record/base.rb:26:in `<top (required)>'
from /Users/.../.rvm/gems/ruby-2.2.1/gems/spring-1.4.0/lib/spring/application.rb:319:in `active_record_configured?'
from /Users/.../.rvm/gems/ruby-2.2.1/gems/spring-1.4.0/lib/spring/application.rb:251:in `disconnect_database'
from /Users/.../.rvm/gems/ruby-2.2.1/gems/spring-1.4.0/lib/spring/application.rb:97:in `preload'
from /Users/.../.rvm/gems/ruby-2.2.1/gems/spring-1.4.0/lib/spring/application.rb:143:in `serve'
from /Users/.../.rvm/gems/ruby-2.2.1/gems/spring-1.4.0/lib/spring/application.rb:131:in `block in run'
from /Users/.../.rvm/gems/ruby-2.2.1/gems/spring-1.4.0/lib/spring/application.rb:125:in `loop'
from /Users/.../.rvm/gems/ruby-2.2.1/gems/spring-1.4.0/lib/spring/application.rb:125:in `run'
from /Users/.../.rvm/gems/ruby-2.2.1/gems/spring-1.4.0/lib/spring/application/boot.rb:18:in `<top (required)>'
from /Users/.../.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/.../.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from -e:1:in `<main>'
EDIT
I had 3 versions of mysql2 in my system. I removed 0.4.1 and 0.3.20. Now I have only 0.3.18 and after I run bundle install, it is saying "using 0.3.18". Alright, but when I run, generate controller I get this error:
Could not find mysql2-0.4.1 in any of the sources
Run `bundle install` to install missing gems.
So looks like rails is trying to use 0.4.1 even though I told it to use 0.3.18.

If you change your Gemfile to downgrade a particular gem version, following these steps will for-sure work:
Delete the Gemfile.lock file:
rm Gemfile.lock
Generate a new Gemfile.lock using Bundle update:
bundle update

Related

How to install device in Rails

I am trying to make a project which requires device. Trying to install it but its showing this error Could not find generator 'devise:install'.
I tried by removing spring also but it is not working. Also I tried by uninstalling and again installing the device file still nothing is happening.
My Gem file is
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '2.6.9'
gem 'device'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails', branch: 'main'
gem 'rails', '~> 6.1.4', '>= 6.1.4.3'
# Use sqlite3 as the database for Active Record
gem 'sqlite3', '~> 1.4'
# Use Puma as the app server
gem 'puma', '~> 5.0'
# Use SCSS for stylesheets
gem 'sass-rails', '>= 6'
# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
gem 'webpacker', '~> 5.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'
# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.4.4', require: false
gem 'rails_warden'
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', '>= 4.1.0'
# Display performance information such as SQL time and flame graphs for each request in your browser.
# Can be configured to work on production as well see: https://github.com/MiniProfiler/rack-mini-profiler/blob/master/README.md
gem 'rack-mini-profiler', '~> 2.0'
gem 'listen', '~> 3.3'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
group :test do
# Adds support for Capybara system testing and selenium driver
gem 'capybara', '>= 3.26'
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]
After runnin command bundle install I am getting following result.
Using rake 13.0.6
Using concurrent-ruby 1.1.9
Using i18n 1.8.11
Using minitest 5.15.0
Using tzinfo 2.0.4
Using zeitwerk 2.5.1
Using activesupport 6.1.4.3
Using builder 3.2.4
Using erubi 1.10.0
Using racc 1.6.0
Using nokogiri 1.12.5 (x86_64-linux)
Using rails-dom-testing 2.0.3
Using crass 1.0.6
Using loofah 2.13.0
Using rails-html-sanitizer 1.4.2
Using actionview 6.1.4.3
Using rack 2.2.3
Using rack-test 1.1.0
Using actionpack 6.1.4.3
Using nio4r 2.5.8
Using websocket-extensions 0.1.5
Using websocket-driver 0.7.5
Using actioncable 6.1.4.3
Using globalid 1.0.0
Using activejob 6.1.4.3
Using activemodel 6.1.4.3
Using activerecord 6.1.4.3
Using marcel 1.0.2
Using mini_mime 1.1.2
Using activestorage 6.1.4.3
Using mail 2.7.1
Using actionmailbox 6.1.4.3
Using actionmailer 6.1.4.3
Using actiontext 6.1.4.3
Using public_suffix 4.0.6
Using addressable 2.8.0
Using bindex 0.8.1
Using msgpack 1.4.2
Using bootsnap 1.9.3
Using bundler 2.2.32
Using byebug 11.1.3
Using matrix 0.4.2
Using regexp_parser 2.2.0
Using xpath 3.2.0
Using capybara 3.36.0
Using childprocess 4.1.0
Using device 0.0.0
Using ffi 1.15.4
Using jbuilder 2.11.3
Using rb-fsevent 0.11.0
Using rb-inotify 0.10.1
Using listen 3.7.0
Using method_source 1.0.0
Using puma 5.5.2
Using rack-mini-profiler 2.3.3
Using rack-proxy 0.7.0
Using thor 1.1.0
Using railties 6.1.4.3
Using sprockets 4.0.2
Using sprockets-rails 3.4.2
Using rails 6.1.4.3
Using warden 1.2.9
Using rails_warden 0.6.0
Using rexml 3.2.5
Using rubyzip 2.3.2
Using sassc 2.4.0
Using tilt 2.0.10
Using sassc-rails 2.1.2
Using sass-rails 6.0.0
Using selenium-webdriver 4.1.0
Using semantic_range 3.0.0
Using spring 3.1.1
Using sqlite3 1.4.2
Using turbolinks-source 5.2.0
Using turbolinks 5.2.1
Using web-console 4.2.0
Using webdrivers 5.0.0
Using webpacker 5.4.3
Bundle complete! 19 Gemfile dependencies, 78 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
Aditya.
You have an spelling error. The gem is devise with "s" and not "c".
gem 'devise'
Execute:
$ bundle
Then you can execute.
$ rails generate devise:install
And everything will be working fine.

fails to start Webrick server uninitialized constant ActionView::Helpers::ActiveM odelHelper (NameError)

I'm going through Lynda tutorials and i'm trying to start a server , but i get an error saying
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.3/lib/action_view/helpers.
rb:40:in `': uninitialized constant ActionView::Helpers::ActiveM
odelHelper (NameError) .
I did run bundle install before that . I copied here gem file as well
C:\Users\berutiel\Documents\sites\tut>bundle install
Resolving dependencies...
Using rake 10.4.2
Using i18n 0.7.0
Using json 1.8.3
Using minitest 5.7.0
Using thread_safe 0.3.5
Using tzinfo 1.2.2
Using activesupport 4.2.3
Using builder 3.2.2
Using erubis 2.7.0
Using mini_portile 0.6.2
Using nokogiri 1.6.6.2
Using rails-deprecated_sanitizer 1.0.3
Using rails-dom-testing 1.0.6
Using loofah 2.0.2
Using rails-html-sanitizer 1.0.2
Using actionview 4.2.3
Using rack 1.6.4
Using rack-test 0.6.3
Using actionpack 4.2.3
Using globalid 0.3.5
Using activejob 4.2.3
Using mime-types 2.6.1
Using mail 2.6.3
Using actionmailer 4.2.3
Using activemodel 4.2.3
Using arel 6.0.2
Using activerecord 4.2.3
Using debug_inspector 0.0.2
Using binding_of_caller 0.7.2
Using bundler 1.10.6
Using columnize 0.9.0
Using byebug 5.0.0
Using multi_json 1.11.2
Using jbuilder 2.3.1
Using mysql2 0.3.19
Using thor 0.19.1
Using railties 4.2.3
Using sprockets 3.2.0
Using sprockets-rails 2.3.2
Using rails 4.2.3
Using rdoc 4.2.0
Using sdoc 0.4.1
Using tzinfo-data 1.2015.5
Using web-console 2.2.1
Bundle complete! 8 Gemfile dependencies, 44 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.
C:\Users\berutiel\Documents\sites\tut>rails server
C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview- 4.2.3/lib/action_view/helpers.
rb:40:in <module:Helpers>': uninitialized constant ActionView::Helpers::ActiveM
odelHelper (NameError)
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview- 4.2.3/lib/action_
view/helpers.rb:4:in <module:ActionView>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview- 4.2.3/lib/action_
view/helpers.rb:3:in <top (required)>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview- 4.2.3/lib/action_
view/base.rb:5:in require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.3/lib/action_
view/base.rb:5:in <top (required)>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_co
nsole/template.rb:7:in <class:Template>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_co
nsole/template.rb:6:in <module:WebConsole>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/web-console- 2.2.1/lib/web_co
nsole/template.rb:1:in <top (required)>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_co
nsole.rb:12:in require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_co
nsole.rb:12:in <top (required)>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web-co
nsole.rb:1:in require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web-co
nsole.rb:1:in <top (required)>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/r
untime.rb:76:in require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/r
untime.rb:76:in block (2 levels) in require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/r
untime.rb:72:in each'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/r
untime.rb:72:in block in require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/r
untime.rb:61:in each'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/r
untime.rb:61:in require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler.r
b:134:in require'
from C:/Users/berutiel/Documents/sites/tut/config/application.rb:7:in <
top (required)>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/com
mands/commands_tasks.rb:78:in require'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/com
mands/commands_tasks.rb:78:in block in server'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/com
mands/commands_tasks.rb:75:in tap'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/com
mands/commands_tasks.rb:75:in server'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/com
mands/commands_tasks.rb:39:in run_command!'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/com
mands.rb:17:in <top (required)>'
from bin/rails:4:in require'
from bin/rails:4:in <main>'
ource 'https://rubygems.org'
Gemfile
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.3'
# Use mysql as the database for Active Record
gem 'mysql2'
# 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
# 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
gem 'rack', '~> 1.6.4'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# 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'
# 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, :x64_mingw, :jruby]
That's weird. The error message you pasted appears to have a typo in it; can you confirm that there's really a space between the M and O of "Model" in this error message?
uninitialized constant ActionView::Helpers::ActiveM odelHelper (NameError) .
Anyway I'd try troubleshooting this in a couple ways:
Can you verify that the Rails gem is installed, and is in the right place? In the app directory, run bundle show nokogiri to find out where the gem nokogiri is installed (or pick any other gem that doesn't appear to be giving errors), then run bundle show rails to verify that Rails is installed inside the same path.
Does actionview show up inside your Gemfile.lock? This file is the "compiled" version of your Gemfile and lists the exact version of every gem dependency your app has. Everything listed here should be installed, so open that and verify that ActionView is in the list. It definitely should be since the rails gem includes / depends on it.
Can you reproduce the problem with a brand new app? Start a fresh app by going out of your app directory, tying rails new test_app, then cd in and run bundle install to install the default gems for this app, then run rails server to see if the error shows up as before. If it DOES reproduce with a fresh app, then you have much more concrete steps for the problem that you can post in the question here to make it easier for us to troubleshoot.
Good luck! Initial setup with the Rails environment can be intensely frustrating, but It Gets Better.
I went through this solution ,RubyInstaller 2.2.1 and Rails - Rake cannot load Nokogiri
The problem is resolved
Thanks to everyone

Rails server won't run - Could not find gem error

When running the rails s command from my terminal (Mac OSX Yosemite) I'm getting the following error:
Could not find mime-types-2.4.3 in any of the sources
Run `bundle install` to install missing gems.
When I run bundle install I get 'Using mime-types 2.4.3'
Using rake 10.4.2
Using i18n 0.7.0
Using json 1.8.2
Using minitest 5.5.1
Using thread_safe 0.3.4
Using tzinfo 1.2.2
Using activesupport 4.2.0
Using builder 3.2.2
Using erubis 2.7.0
Using mini_portile 0.6.2
Using nokogiri 1.6.6.2
Using rails-deprecated_sanitizer 1.0.3
Using rails-dom-testing 1.0.5
Using loofah 2.0.1
Using rails-html-sanitizer 1.0.1
Using actionview 4.2.0
Using rack 1.6.0
Using rack-test 0.6.3
Using actionpack 4.2.0
Using globalid 0.3.3
Using activejob 4.2.0
Using mime-types 2.4.3
Using mail 2.6.3
Using actionmailer 4.2.0
Using activemodel 4.2.0
Using arel 6.0.0
Using activerecord 4.2.0
Using debug_inspector 0.0.2
Using binding_of_caller 0.7.2
Using coffee-script-source 1.9.1
Using execjs 2.3.0
Using coffee-script 2.3.0
Using thor 0.19.1
Using railties 4.2.0
Using coffee-rails 4.1.0
Using hike 1.2.3
Using multi_json 1.10.1
Using jbuilder 2.2.8
Using jquery-rails 4.0.3
Using bundler 1.7.12
Using tilt 1.4.1
Using sprockets 2.12.3
Using sprockets-rails 2.2.4
Using rails 4.2.0
Using rdoc 4.2.0
Using sass 3.4.12
Using sass-rails 5.0.1
Using sdoc 0.4.1
Using spring 1.3.2
Using sqlite3 1.3.10
Using turbolinks 2.5.3
Using uglifier 2.7.0
Using web-console 2.0.0
But running the 'rails s' command again results in the same error message:
Could not find mime-types-2.4.3 in any of the sources
Run `bundle install` to install missing gems.
Here's the gemfile (the default one w my Rails 4.2 created):
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.0'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# 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/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# 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', '~> 3.1.7'
# Use Unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development, :test do
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
Note - mime-types 2.4.3 is located in the Gemfile.lock
Any ideas as to what the problem might be?
Thank you for your time.
try bundle install --path vendor/cache
Try
bundle update mime-types
then run server again.

RSpec fails to generate spec folder

Okay,
trying to set up a new rails project, but for some strange reason I'm unable to get my RSpec installed. It keeps throwing the following error:
c700595:retro deh0002a$ bundle exec rails generate rspec:install
Could not find rspec-support-3.0.4 in any of the sources
Run `bundle install` to install missing gems.
This is what my gemfile looks like:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.6'
# Use postgresql as the database for Active Record
gem 'pg'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# 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
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring', group: :development
# Use ActiveModel has_secure_password
gem 'bcrypt', '~> 3.1.7'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
group :development, :test do
gem 'rspec-rails', '~> 3.0.0'
end
I've run the bundle install command as the error suggests:
c700595:retro deh0002a$ bundle install
Using rake 10.3.2
Using i18n 0.6.11
Using json 1.8.1
Using minitest 5.4.2
Using thread_safe 0.3.4
Using tzinfo 1.2.2
Using activesupport 4.1.6
Using builder 3.2.2
Using erubis 2.7.0
Using actionview 4.1.6
Using rack 1.5.2
Using rack-test 0.6.2
Using actionpack 4.1.6
Using mime-types 2.4.3
Using mail 2.6.1
Using actionmailer 4.1.6
Using activemodel 4.1.6
Using arel 5.0.1.20140414130214
Using activerecord 4.1.6
Using bcrypt 3.1.7
Using coffee-script-source 1.8.0
Using execjs 2.2.2
Using coffee-script 2.3.0
Using thor 0.19.1
Using railties 4.1.6
Using coffee-rails 4.0.1
Using diff-lcs 1.2.5
Using hike 1.2.3
Using multi_json 1.10.1
Using jbuilder 2.2.4
Using jquery-rails 3.1.2
Using pg 0.17.1
Using bundler 1.7.4
Using tilt 1.4.1
Using sprockets 2.11.0
Using sprockets-rails 2.2.0
Using rails 4.1.6
Using rdoc 4.1.2
Using rspec-support 3.0.4
Using rspec-core 3.0.4
Using rspec-expectations 3.0.4
Using rspec-mocks 3.0.4
Using rspec-rails 3.0.2
Using sass 3.2.19
Using sass-rails 4.0.3
Using sdoc 0.4.1
Using spring 1.1.3
Using turbolinks 2.5.1
Using uglifier 2.5.3
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
So from my bundler output, the missing gem is actually there.
Can someone please tell me what I'm actually missing in this case?
Reinstalled RVM, Rails and everything and now it works.
Guess something destroyed somethin somewhere in regards to paths......

Can't bundle sass-rails (4.0.3) ruby gem

When I try to bundle install or update, it gives me this error:
> bundle install
DL is deprecated, please use Fiddle
Fetching gem metadata from https://rubygems.org/..........
Resolving dependencies...
Using rake 10.3.2
Using i18n 0.6.11
Using json 1.8.1
Using minitest 5.4.1
Using thread_safe 0.3.4
Using tzinfo 1.2.2
Using activesupport 4.1.1
Using builder 3.2.2
Using erubis 2.7.0
Using actionview 4.1.1
Using rack 1.5.2
Using rack-test 0.6.2
Using actionpack 4.1.1
Using mime-types 1.25.1
Using polyglot 0.3.5
Using treetop 1.4.15
Using mail 2.5.4
Using actionmailer 4.1.1
Using activemodel 4.1.1
Using arel 5.0.1.20140414130214
Using activerecord 4.1.1
Using sass 3.2.19
Using bootstrap-sass 3.2.0.0
Using bundler 1.7.3
Using coffee-script-source 1.8.0
Using execjs 2.2.1
Using coffee-script 2.3.0
Using thor 0.19.1
Using railties 4.1.1
Using coffee-rails 4.0.1
Using fullcalendar-rails 1.6.4.0
Using hike 1.2.3
Using multi_json 1.10.1
Using jbuilder 2.1.3
Using jquery-rails 3.1.2
Using tilt 1.4.1
Using sprockets 2.11.0
Using sprockets-rails 2.1.4
Using rails 4.1.1
Using rdoc 4.1.2
Errno::ENOENT: No such file or directory # rb_sysopen - C:/<ruby-app-dir>/vendor/bundle/ruby/2.1.0/gems/sass-rails-4.0.3/test/fixtures/alternate_config_p
roject/app/assets/stylesheets/partials/subfolder/relative_not_a_partial.css.scss
An error occurred while installing sass-rails (4.0.3), and Bundler cannot
continue.
Make sure that `gem install sass-rails -v '4.0.3'` succeeds before bundling.
However, running gem install sass-rails -v '4.0.3' succeeds with no errors.
edit: The file throwing the error does not, in fact, exist, although the sass-rails gem does have such a file. Manually putting in the file doesn't help.
64-bit Windows 8.1 with 32-bit Ruby, although I got the same error on 64-bit ruby.
gem -v: 2.2.2
bundle -v: 1.7.3
Gemfile:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.1'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# 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
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring', group: :development
# bootstrap!
gem 'bootstrap-sass'
gem 'fullcalendar-rails'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
Sass is compatible with Ruby 2 as of version 3.1.18, so that shouldn't be an issue.
try to run gem install saas-rails in your working directory.
https://rubygems.org/gems/sass-rails

Resources