Trouble Installing Bootstrap on Rails - ruby-on-rails

I am trying to install Bootstrap on Rails but can't seem to get it installed. I have ran bundle install , bundle update and rails server but just can't seem to get it to work.
Here is the error code:
File to import not found or unreadable: bootstrap.
Load paths:
c:/Users/teddynuts/Desktop/pinteresting/app/assets/images
c:/Users/teddynuts/Desktop/pinteresting/app/assets/javascripts
c:/Users/teddynuts/Desktop/pinteresting/app/assets/stylesheets
c:/Users/teddynuts/Desktop/pinteresting/vendor/assets/javascripts
c:/Users/teddynuts/Desktop/pinteresting/vendor/assets/stylesheets
c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/turbolinks-2.2.2/lib/assets/javascripts c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/jquery-rails-3.1.0/vendor/assets/javascripts
c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/coffee-rails-4.0.1/lib/assets/javascripts
(in c:/Users/teddynuts/Desktop/pinteresting/app/assets/stylesheets/bootstrap_and_customization.css.scss:1)
My CSS file titled bootstrap_and_customization.css.scss code is:
#import "bootstrap";
My Gem file code is:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.0'
# 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'
gem 'bootstrap-sass',
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
# Use debugger
# gem 'debugger', group: [:development, :test]
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin]

You need to assign something to your "group". What goes into group :doc ?
I see that you are taking the One Month Rails Tutorial, so the gemfile for the Lesson (Until bootstrap) should be this:
source 'https://rubygems.org'
gem 'rails', '4.1.0'
gem 'sass-rails', '~> 4.0.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jquery-turbolinks'
gem 'jbuilder', '~> 1.2'
gem 'bootstrap-sass', '~> 3.1.1'
# Gems for Local Development
group :development, :test do
gem 'sqlite3'
end
# Gems for Heroku
group :production do
gem 'pg'
gem 'rails_12factor'
end
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
Official Sass port of Bootstrap
Sometimes when you are stuck just give the Official Repo a look.

The problem is here:
gem 'bootstrap-sass',
group: :doc
It may not be obvious, but it's one statement. In fact, it's interpreted like this:
gem 'bootstrap-sass', { :group => :doc }
...and therefore the specified gem is only available during docs generation. And the solution for this exact issue is to replace the above with:
gem 'bootstrap-sass'
However, since you're on Windows (if it's x64, which is likely), you may run into other issues, like this one.

Try bootstrap-sass-rails instead. It works in the asset pipeline. https://github.com/yabawock/bootstrap-sass-rails

Related

How to fix `require': cannot load such file -- nokogiri/2.1/nokogiri (LoadError)

I see many answers for this error when ruby version is =>2.2, but in my computer installed ruby version is [ruby 2.1.8p440]
I get this error when starting a server ( rails server ).
Gemfile
source 'http://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.8'
# Use sqlite3 as the database for Active Record
#gem 'sqlite3'
gem 'pg', '0.18.2'
# Use SCSS for stylesheets
#gem 'sass-rails', '~> 4.0.3'
gem 'rails_12factor', group: :production
# 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
# 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]
gem 'sass-rails', '>= 3.3.4'
gem 'bootstrap-sass', '~> 3.3.6'
gem 'ckeditor', '4.1.6'
gem 'carrierwave', '0.10.0'
gem 'fog', '~> 1.3.1'
gem 'mini_magick', '4.5.1'
gem 'will_paginate', '3.1.0'
gem 'nokogiri', '>= 1.5.0'
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin]
You need to run bundle (or bundle install, but bundle does the same thing), to install the gems that are necessary for the app to run.

Rails Bootstrap V4 alpha 3 gem install fail

I get the following error when I run bundle install do I just need to install x86-mingw32 or? Any help would be really appreciated also would it be better that I just use the CDN version?
Could not find gem 'bootstrap (>= 4.0.0.alpha2, ~> 4.0) x86-mingw32
the gem sources listed in your Gemfile or available on this machine
Here is my Gem file
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.5'
# 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.1'
#Bootstrap 4 alpha 3 gem for amazing sexiness
gem 'bootstrap', '~> 4.0', '>= 4.0.0.alpha2'
#coffee script for well cofee script stuff
gem 'coffee-script-source', '1.8.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
# 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'
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, :x64_mingw, :jruby]
Just wondering, why do you need two gem specifiers? I got the same error running it your way but then I retried using one specifier:
gem 'bootstrap', '>= 4.0.0.alpha2'
And it worked for me.
Note: You can check releases for this gem here

Type Error with Active Admin - Ruby on Rails

I am new to Ruby on Rails(4.1.8) and using OS Windows 8, I have added the gem activeadmin in my gemfile and ran commands
rails g active_admin:install --skip-users
rake db:migrate
rails server
but I get the following exception while running http://localhost:3000/admin
TypeError: Object doesn't support this property or method (in
c:/Sites/CleverChalk/app/assets/javascripts/active_admin.js.coffee)
Could someone please advise why this occurs. i read a couple of post on
coffee-script-source and
coffee-rails but they have not worked for me.
My Gemfile is as below :
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.8'
# Use sqlite3 as the database for Active Record
#gem 'sqlite3'
gem 'pg'
gem 'activeadmin', github: 'activeadmin'
gem 'coffee-script-source', '1.8.0'
gem 'coffee-rails', '~> 4.0.0'
# 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
# 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]
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin]
I could resolve the issue by reinstalling activeadmin with Users that meant adding the devise gem as shown below:
gem 'devise'
to the gemfile and then
bundle install
rails generate devise:install
Thanks.

Rails, Can't deploy app to heroku

I am new to rails, but got an app working great. Now I want to publish it to the web for a test. I am trying heroku, but can't get it to work.
Here is my gemfile:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.4'
# Use sqlite3 as the database for Active Record
group :production do
gem 'pg'
end
group :development, :test do
gem 'sqlite3'
end
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
gem "font-awesome-rails"
gem 'carrierwave'
gem "rmagick"
gem 'responders', '~> 2.0'
gem 'prawn'
gem 'prawn-table'
gem 'bcrypt'
# 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
# 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'
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, :x64_mingw, :jruby]
And the error when doing the git push:
The thing is when doing the git push, it cannot install pg, tilt (it is not even in my gemfile, why does it even try?), and prawn, but mainly fails on pg.
I am doing this on a windows machine.
I got successfully to this part of the heroku guide for windows: https://devcenter.heroku.com/articles/getting-started-with-jruby#deploy-the-app
Then tried deleting the rails files and folders, and copying over the ones from my app, but it fails as shown above.
Thanks in advance for your help.

Why did I get "LoadError: cannot load such file -- nokogiri"?

I am trying to deploy my Ruby on Rails application onto the DigitalOcean server, but I got
LoadError: cannot load such file -- nokogiri
when I ran
cap production deploy:initial
from my local machine. I never required Nokogiri in my Gemfile or installed it for my application.
This is the error:
This is my gemfile:
source 'https://rubygems.org'
ruby "2.0.0"
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.3'
# 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/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
group :development, :test do
gem 'mysql2', '~> 0.3.13'
gem 'byebug'
gem 'web-console', '~> 2.0'
gem "rails-erd"
gem 'capistrano', require: false
gem 'capistrano-rvm', require: false
gem 'capistrano-rails', require: false
gem 'capistrano-bundler', require: false
#gem 'capistrano-passenger', require: false
gem 'capistrano3-puma', require: false
end
group :production do
gem 'rails_12factor', '0.0.2'
gem 'thin'
gem 'puma'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
#bootstrap
gem 'bootstrap-sass', '~> 3.3.4.1'
gem "better_errors"
#for user authentication
gem "devise"
gem 'rails_admin', '~> 0.6.8'
gem 'jquery-ui-rails'
Nokogiri is a dependency of one of the gems you're using.
The most common cause for your problem is using different OSes in development and in production, such as developing in Windows and deploying to Linux.
The simplest, but not the best, fix is to edit your Gemfile.lock and remove all -x86-mingw32 references from the gem versions. For instance, replace
nokogiri (1.6.6.2-x86-mingw32)
with
nokogiri (1.6.6.2)
Nokogiri will not be the only gem version you'll have to edit manually, so search for other gems with -x86-mingw32 in their versions. There will also be at least pg. It does not cause an error during deploy, it simply does not install if your Gemfile.lock was generated on Windows.

Resources