Sass::SyntaxError: Undefined variable: "$fa-css-prefix" - css

I am trying to integrate the present theme in my rails app. After intgerating when I run
rake assets:precompile --trace
I get the following error.
** Invoke assets:precompile (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Execute assets:precompile
rake aborted!
Sass::SyntaxError: Undefined variable: "$fa-css-prefix".
/home/munam/projects/infotachus/ror/nutritious_dec_28/app/assets/stylesheets/_animated.scss:4
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sass-3.4.20/lib/sass/script/tree/variable.rb:49:in `_perform'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sass-3.4.20/lib/sass/script/tree/node.rb:50:in `perform'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sass-3.4.20/lib/sass/script/tree/interpolation.rb:170:in `_perform'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sass-3.4.20/lib/sass/script/tree/node.rb:50:in `perform'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/perform.rb:540:in `block in run_interp_no_strip'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/perform.rb:538:in `map'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/perform.rb:538:in `run_interp_no_strip'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/perform.rb:545:in `run_interp'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/perform.rb:410:in `visit_rule'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/base.rb:36:in `visit'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/perform.rb:158:in `block in visit'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sass-3.4.20/lib/sass/stack.rb:79:in `block in with_base'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sass-3.4.20/lib/sass/stack.rb:115:in `with_frame'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sass-3.4.20/lib/sass/stack.rb:79:in `with_base'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/perform.rb:158:in `visit'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/base.rb:52:in `block in visit_children'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/base.rb:52:in `map'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/base.rb:52:in `visit_children'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/perform.rb:167:in `block in visit_children'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/perform.rb:179:in `with_environment'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/perform.rb:166:in `visit_children'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/base.rb:36:in `block in visit'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/perform.rb:186:in `visit_root'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/base.rb:36:in `visit'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/perform.rb:157:in `visit'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sass-3.4.20/lib/sass/tree/visitors/perform.rb:8:in `visit'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sass-3.4.20/lib/sass/tree/root_node.rb:36:in `css_tree'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sass-3.4.20/lib/sass/tree/root_node.rb:20:in `render'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sass-3.4.20/lib/sass/engine.rb:278:in `render'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sprockets-3.5.2/lib/sprockets/sass_processor.rb:74:in `block in call'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sprockets-3.5.2/lib/sprockets/utils.rb:154:in `module_include'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sprockets-3.5.2/lib/sprockets/sass_processor.rb:73:in `call'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sprockets-3.5.2/lib/sprockets/sass_processor.rb:30:in `call'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sprockets-3.5.2/lib/sprockets/processor_utils.rb:75:in `call_processor'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sprockets-3.5.2/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sprockets-3.5.2/lib/sprockets/processor_utils.rb:56:in `reverse_each'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sprockets-3.5.2/lib/sprockets/processor_utils.rb:56:in `call_processors'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sprockets-3.5.2/lib/sprockets/loader.rb:134:in `load_from_unloaded'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sprockets-3.5.2/lib/sprockets/loader.rb:60:in `block in load'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sprockets-3.5.2/lib/sprockets/loader.rb:318:in `fetch_asset_from_dependency_cache'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sprockets-3.5.2/lib/sprockets/loader.rb:44:in `load'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sprockets-3.5.2/lib/sprockets/cached_environment.rb:20:in `block in initialize'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sprockets-3.5.2/lib/sprockets/cached_environment.rb:47:in `yield'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sprockets-3.5.2/lib/sprockets/cached_environment.rb:47:in `load'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sprockets-3.5.2/lib/sprockets/bundle.rb:23:in `block in call'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sprockets-3.5.2/lib/sprockets/utils.rb:183:in `dfs'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sprockets-3.5.2/lib/sprockets/bundle.rb:24:in `call'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sprockets-3.5.2/lib/sprockets/processor_utils.rb:75:in `call_processor'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sprockets-3.5.2/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sprockets-3.5.2/lib/sprockets/processor_utils.rb:56:in `reverse_each'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sprockets-3.5.2/lib/sprockets/processor_utils.rb:56:in `call_processors'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sprockets-3.5.2/lib/sprockets/loader.rb:134:in `load_from_unloaded'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sprockets-3.5.2/lib/sprockets/loader.rb:60:in `block in load'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sprockets-3.5.2/lib/sprockets/loader.rb:318:in `fetch_asset_from_dependency_cache'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sprockets-3.5.2/lib/sprockets/loader.rb:44:in `load'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sprockets-3.5.2/lib/sprockets/cached_environment.rb:20:in `block in initialize'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sprockets-3.5.2/lib/sprockets/cached_environment.rb:47:in `yield'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sprockets-3.5.2/lib/sprockets/cached_environment.rb:47:in `load'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sprockets-3.5.2/lib/sprockets/base.rb:66:in `find_asset'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sprockets-3.5.2/lib/sprockets/base.rb:73:in `find_all_linked_assets'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sprockets-3.5.2/lib/sprockets/manifest.rb:142:in `block in find'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sprockets-3.5.2/lib/sprockets/legacy.rb:114:in `block (2 levels) in logical_paths'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sprockets-3.5.2/lib/sprockets/path_utils.rb:225:in `block in stat_tree'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sprockets-3.5.2/lib/sprockets/path_utils.rb:209:in `block in stat_directory'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sprockets-3.5.2/lib/sprockets/path_utils.rb:206:in `each'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sprockets-3.5.2/lib/sprockets/path_utils.rb:206:in `stat_directory'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sprockets-3.5.2/lib/sprockets/path_utils.rb:224:in `stat_tree'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sprockets-3.5.2/lib/sprockets/legacy.rb:105:in `each'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sprockets-3.5.2/lib/sprockets/legacy.rb:105:in `block in logical_paths'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sprockets-3.5.2/lib/sprockets/legacy.rb:104:in `each'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sprockets-3.5.2/lib/sprockets/legacy.rb:104:in `logical_paths'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sprockets-3.5.2/lib/sprockets/manifest.rb:140:in `find'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sprockets-3.5.2/lib/sprockets/manifest.rb:168:in `compile'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sprockets-rails-3.0.0/lib/sprockets/rails/task.rb:68:in `block (3 levels) in define'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sprockets-3.5.2/lib/rake/sprocketstask.rb:147:in `with_logger'
/home/munam/.rvm/gems/ruby-2.2.3#Nutritious/gems/sprockets-rails-3.0.0/lib/sprockets/rails/task.rb:67:in `block (2 levels) in define'
/home/munam/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rake/task.rb:240:in `call'
/home/munam/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rake/task.rb:240:in `block in execute'
/home/munam/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rake/task.rb:235:in `each'
/home/munam/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rake/task.rb:235:in `execute'
/home/munam/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rake/task.rb:179:in `block in invoke_with_call_chain'
/home/munam/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
/home/munam/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rake/task.rb:172:in `invoke_with_call_chain'
/home/munam/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rake/task.rb:165:in `invoke'
/home/munam/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rake/application.rb:150:in `invoke_task'
/home/munam/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rake/application.rb:106:in `block (2 levels) in top_level'
/home/munam/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rake/application.rb:106:in `each'
/home/munam/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rake/application.rb:106:in `block in top_level'
/home/munam/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rake/application.rb:115:in `run_with_threads'
/home/munam/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rake/application.rb:100:in `top_level'
/home/munam/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rake/application.rb:78:in `block in run'
/home/munam/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rake/application.rb:176:in `standard_exception_handling'
/home/munam/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rake/application.rb:75:in `run'
/home/munam/.rvm/rubies/ruby-2.2.3/bin/rake:33:in `<main>'
I have three folders in my theme
less
css
scss
When integrating into my app I have merged files of these folders in one folder.
app/assets/stylesheets
Here are the gems in my gemfile.
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 'pg'
# Use SCSS for stylesheets
# 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 :assets do
gem 'sass-rails', '~> 5.0'
gem 'font-awesome-rails'
gem 'font-awesome-sass'
gem 'font-awesome-sass-rails'
gem 'twitter-bootstrap-rails', :git => 'git://github.com/seyhunak/twitter-bootstrap-rails.git'
end
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
gem 'dotenv-rails'
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
gem 'better_errors'
gem 'binding_of_caller'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
gem 'devise'
gem 'amazon-ecs'
gem 'sucker'
gem 'vacuum'
gem 'actionpack-xml_parser'
I have only these two lines in my application.css
*
*= require_tree .
*= require_self
*/
and this line in my config/initializers/assets.rb
Rails.application.config.assets.precompile += [/.*\.png/,/.*\.ico/,/.*\.jpg/,/.*\.js/,/.*\.scss/]
I have tried all the threads on stackoverflow and github but nothing seems to work in my case. What to look for is still not clear. Any help would be really great. Lots of thanks in advance!

You only need one reference to font-awesome once in your Gemfile:
gem 'font-awesome-rails', '~> 4.5'
--
As for the error, it means you're trying to call a variable before it's been declared.
Because this is a font-awesome error, I'd speculate that it's because you've included 3 different gems in your Gemfile.
Get rid of all the gems except the one I've included above.
You also need to include the relevant font-awesome files in your CSS pipeline:
#app/assets/stylesheets/application.css
*
*= require font-awesome
*= require_tree .
*= require_self
*/

Just add these lines in your config/application.rb if you are using scss instead of css.
config.assets.precompile << %w( *.scss *.js )

Related

Can't import bootstrap

I've looked through many solutions but still can't find the solution to my problem. I'm using Rails 5.0.0.1, running on Windows OS. I've done bundle install and restarted the server, as well as downgrading the sass-rails but I can't seem to fix the issue.
The gems I needed for this:
bootstrap-sass <3.3.7>
sass-rails <5.0.6, 3.2.0>
In my application.scss file:
#import "bootstrap-sprockets";
#import "bootstrap";
In my application.js file:
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= bootstrap-sprockets
//= require_tree .
The error page
Please help! Thanks!
EDIT
Here is my Gem list:
(It didn't use to have two versions but I think I might have messed it up some how when I downgraded sass-rails and then installed the autoprefixer-rails gem for a different solution I found.)
* LOCAL GEMS *
actioncable (5.0.0.1)
actionmailer (5.0.0.1, 4.2.6)
actionpack (5.0.0.1, 4.2.6, 3.2.
actionview (5.0.0.1, 4.2.6)
activejob (5.0.0.1, 4.2.6)
activemodel (5.0.0.1, 4.2.6, 3.2
activerecord (5.0.0.1, 4.2.6)
activesupport (5.0.0.1, 4.2.6, 3
arel (7.1.2, 7.1.1, 6.0.3)
autoprefixer-rails (6.5.3)
bigdecimal (default: 1.2.6)
binding_of_caller (0.7.2)
bootstrap-sass (3.3.7)
builder (3.2.2, 3.0.4)
bundler (1.13.6, 1.12.5)
byebug (9.0.5)
coffee-rails (4.2.1, 4.1.1)
coffee-script (2.4.1)
coffee-script-source (1.10.0)
concurrent-ruby (1.0.2)
debug_inspector (0.0.2)
erubis (2.7.0)
execjs (2.7.0)
gem-path (0.6.1)
globalid (0.3.7)
hike (1.2.3)
i18n (0.7.0)
io-console (default: 0.4.3)
jbuilder (2.6.0)
journey (1.0.4)
jquery-rails (4.2.1)
json (1.8.3, default: 1.8.1)
loofah (2.0.3)
mail (2.6.4)
method_source (0.8.2)
mime-types (3.1)
mime-types-data (3.2016.0521)
mini_portile2 (2.1.0)
minitest (5.9.0, 5.4.3)
multi_json (1.12.1)
nio4r (1.2.1)
nokogiri (1.6.8 x64-mingw32)
pkg-config (1.1.7)
power_assert (0.2.2)
psych (default: 2.0.8)
puma (3.6.0)
rack (2.0.1, 1.6.4, 1.4.7)
rack-cache (1.6.1)
rack-ssl (1.3.4)
rack-test (0.6.3)
rails (5.0.0.1, 4.2.6)
rails-deprecated_sanitizer (1.0.
rails-dom-testing (2.0.1, 1.0.7)
rails-html-sanitizer (1.0.3)
railties (5.0.0.1, 4.2.6, 3.2.22
rake (11.2.2, default: 10.4.2)
rdoc (4.2.2, default: 4.2.0, 3.1
rubygems-update (2.6.8)
sass (3.4.22, 3.1.21)
sass-rails (5.0.6, 3.2.0)
sdoc (0.4.1)
spring (1.7.2)
sprockets (3.7.0, 2.2.3)
sprockets-rails (3.2.0)
sqlite3 (1.3.11 x64-mingw32)
test-unit (3.0.8)
thor (0.19.1)
thread_safe (0.3.5)
tilt (2.0.5, 1.4.1)
turbolinks (5.0.1)
turbolinks-source (5.0.0)
tzinfo (1.2.2)
tzinfo-data (1.2016.6)
uglifier (3.0.2)
web-console (3.3.1, 2.3.0)
websocket-driver (0.6.4)
websocket-extensions (0.1.2)
After adding #import "bootstrap-sprockets"; #import "bootstrap"; in your application.scss file, remove all the *= require_self and *= require_tree . statements from the sass file.

rails server not starting- undefined method `formatter' for nil:NilClass (NoMethodError) error

I am using rails 4.1, but when i try to run 'rails s' on the terminal it give this error:
Exiting
/home/ben/.rvm/gems/ruby-2.0.0-p247#addtocartalerts/gems/railties-4.0.4/lib/rails/commands/server.rb:78:in `start': undefined method `formatter' for nil:NilClass (NoMethodError)
from /home/ben/.rvm/gems/ruby-2.0.0-p247#addtocartalerts/gems/railties-4.0.4/lib/rails/commands.rb:76:in `block in <top (required)>'
from /home/ben/.rvm/gems/ruby-2.0.0-p247#addtocartalerts/gems/railties-4.0.4/lib/rails/commands.rb:71:in `tap'
from /home/ben/.rvm/gems/ruby-2.0.0-p247#addtocartalerts/gems/railties-4.0.4/lib/rails/commands.rb:71:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
please help
You are not using rails 4.1. Look at the railties gem path. It says railties 4.0.4
Check Gemfile for right version. Do bundle update rails. Then use binstubs or bundle exec rails s if you have multiple rails gems installed

Rails 4 fails on sqlite3

I get this error when I run a new empty rails (4.0) site:
Specified 'sqlite3' for database adapter, but the gem is not loaded. Add `gem 'sqlite3'` to your Gemfile.
I have a valid sqlite3 gem built with the devkit. I made a dumb test for that:
w:...> ruby hello.rb
hello world
test.db is done.
Which also creates an empty database, called "test.db" as shown below. Simple ruby script:
require "sqlite3"
puts "hello world"
# Open a database
db = SQLite3::Database.new "test.db"
puts "test.db is done."
My conclusion is that the sqlite3 gem is working OK and that there's something amiss inside rails some place. Suggestions or explanations welcome.
Bit of an update following the comment about Gemfile:
# Use sqlite3 as the database for Active Record
gem 'sqlite3', group: [:development, :test]
In addition, I used the bundle show command, and I find this strange:
w:...> bundle show sqlite3
Could not find gem 'sqlite3'.
Did you mean sqlite3?
When I do a bundle install the output list does not include sqlite3. I should add the Gemfile and everything else was generated right out of the box by a "rails new train" command (project name, 'train' of course).
Environment is an install of Ruby v2, Rails v4 on Windows 7 64-bit PC. I have PIK to manage different versions of ruby. Suggestions welcome, thanks in advance, Will.
Everything is/should be fresh-out-of-the-box Rails 4/Ruby 2 configuration. I'm adding the server's stack dump also, since in theory a fresh install should be working.
Gem::LoadError (Specified 'sqlite3' for database adapter, but the gem is not loaded. Add `gem 'sqlite3'` to your Gemfile.):
activerecord (4.0.0) lib/active_record/connection_adapters/connection_specification.rb:58:in `rescue in resolve_hash_connection'
activerecord (4.0.0) lib/active_record/connection_adapters/connection_specification.rb:55:in `resolve_hash_connection'
activerecord (4.0.0) lib/active_record/connection_adapters/connection_specification.rb:46:in `resolve_string_connection'
activerecord (4.0.0) lib/active_record/connection_adapters/connection_specification.rb:30:in `spec'
activerecord (4.0.0) lib/active_record/connection_handling.rb:39:in `establish_connection'
activerecord (4.0.0) lib/active_record/railtie.rb:175:in `block (2 levels) in <class:Railtie>'
activesupport (4.0.0) lib/active_support/lazy_load_hooks.rb:38:in `instance_eval'
activesupport (4.0.0) lib/active_support/lazy_load_hooks.rb:38:in `execute_hook'
activesupport (4.0.0) lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'
activesupport (4.0.0) lib/active_support/lazy_load_hooks.rb:44:in `each'
activesupport (4.0.0) lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'
activerecord (4.0.0) lib/active_record/base.rb:322:in `<module:ActiveRecord>'
activerecord (4.0.0) lib/active_record/base.rb:22:in `<top (required)>'
activerecord (4.0.0) lib/active_record/query_cache.rb:50:in `restore_query_cache_settings'
activerecord (4.0.0) lib/active_record/query_cache.rb:43:in `rescue in call'
activerecord (4.0.0) lib/active_record/query_cache.rb:32:in `call'
activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:626:in `call'
activerecord (4.0.0) lib/active_record/migration.rb:369:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.0.0) lib/active_support/callbacks.rb:373:in `_run__398267657__call__callbacks'
activesupport (4.0.0) lib/active_support/callbacks.rb:80:in `run_callbacks'
actionpack (4.0.0) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/reloader.rb:64:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.0.0) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.0.0) lib/rails/rack/logger.rb:21:in `block in call'
activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `block in tagged'
activesupport (4.0.0) lib/active_support/tagged_logging.rb:25:in `tagged'
activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `tagged'
railties (4.0.0) lib/rails/rack/logger.rb:21:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
rack (1.5.2) lib/rack/runtime.rb:17:in `call'
activesupport (4.0.0) lib/active_support/cache/strategy/local_cache.rb:83:in `call'
rack (1.5.2) lib/rack/lock.rb:17:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/static.rb:64:in `call'
railties (4.0.0) lib/rails/engine.rb:511:in `call'
railties (4.0.0) lib/rails/application.rb:97:in `call'
rack (1.5.2) lib/rack/lock.rb:17:in `call'
rack (1.5.2) lib/rack/content_length.rb:14:in `call'
rack (1.5.2) lib/rack/handler/webrick.rb:60:in `service'
B:/lang/ruby/v02.00/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
B:/lang/ruby/v02.00/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
B:/lang/ruby/v02.00/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'
Two bits of news to report. I was passed an explanation for this on the PIK mailing list:
[Luis Lavena] You don't indicate which version of Ruby 2.0 are you using (the exact output of "ruby -v"), but I will assume is x64 bit, correct?
If that is the case, then you're affected by a bug in Bundler. The same was reported here:
https://github.com/sparklemotion/sqlite3-ruby/issues/109
Yes, the problem is happening with Ruby v2 64-bit
w:...> ruby -v
ruby 2.0.0p195 (2013-05-14) [x64-mingw32]
w:...> bundle -v
Bundler version 1.3.5
Reading the sparklemotion post the error lies with Bundler. To be fathomed I guess.
On the plus side. I used Rails 4 with Ruby 2 to make the rails project and can run the server to use SQLite3 using JRuby by changing the Gemfile to use the jdbc driver, as shown:
# Use sqlite3 as the database for Active Record
group :development, :test do
# gem 'sqlite3'
gem 'activerecord-jdbc-adapter'
gem 'jdbc-sqlite3'
end
It almost looks like Bundler has a thing against SQLite3 doesn't it?
One last thing. The Sqlite3 gem build OK with Ruby v2 and works, as demonstrated with my toy test program. Since it is just a Gem ... the Bundler problem may pop-up for some other gems -- Be alert, probably best to upgrade as soon as you see the problem:
w:...> ruby -S gem update bundler --prerelease
Updating installed gems
Updating bundler
Fetching: bundler-1.4.0.rc.1.gem (100%)
Successfully installed bundler-1.4.0.rc.1
Parsing documentation for bundler-1.4.0.rc.1
Installing ri documentation for bundler-1.4.0.rc.1
Installing darkfish documentation for bundler-1.4.0.rc.1
Done installing documentation for bundler after 9 seconds
Gems updated: bundler
Just check the list
w:...> bundle list
Gems included by the bundle:
:
* sprockets (2.10.0)
* sprockets-rails (2.0.1)
* sqlite3 (1.3.8)
* thor (0.18.1)
:
Works a treat!
:-)
Dou you have:
gem 'sqlite3'
or something like this
gem 'sqlite3', group: [:development, :test]
in your Gemfile?

CSS not recognized on Heroku deploy of rails app

I know this question has been asked over, and over, and even here... I have tried all of these changes, yet am still having no such luck. My heroku app lives at http://calm-mountain-2401.herokuapp.com/, and I am extremely frustrated by this. My gemfile looks like:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0'
group :production do
gem 'pg'
end
group :development, :test do
gem 'sqlite3'
end
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'
# 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', '~> 1.2'
gem 'jquery-turbolinks'
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
I have been able to successfully deploy, however the code is very obviously not CSS-ified. Any help would be much appreciated!
Alex
EDIT: here is the output of git push heroku master
$ git push heroku master
Counting objects: 9, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 496 bytes, done.
Total 5 (delta 3), reused 0 (delta 0)
-----> Ruby/Rails app detected
-----> Using Ruby version: ruby-2.0.0
-----> Installing dependencies using Bundler version 1.3.2
Running: bundle install --without development:test --path vendor/bundle -- binstubs vendor/bundle/bin --deployment
Using rake (10.1.0)
Using i18n (0.6.5)
Using minitest (4.7.5)
Using multi_json (1.8.0)
Using atomic (1.1.14)
Using thread_safe (0.1.3)
Using tzinfo (0.3.37)
Using activesupport (4.0.0)
Using builder (3.1.4)
Using erubis (2.7.0)
Using rack (1.5.2)
Using rack-test (0.6.2)
Using actionpack (4.0.0)
Using mime-types (1.25)
Using polyglot (0.3.3)
Using treetop (1.4.15)
Using mail (2.5.4)
Using actionmailer (4.0.0)
Using activemodel (4.0.0)
Using activerecord-deprecated_finders (1.0.3)
Using arel (4.0.0)
Using activerecord (4.0.0)
Using coffee-script-source (1.6.3)
Using execjs (2.0.1)
Using coffee-script (2.2.0)
Using thor (0.18.1)
Using railties (4.0.0)
Using coffee-rails (4.0.0)
Using hike (1.2.3)
Using jbuilder (1.5.1)
Using jquery-rails (3.0.4)
Using turbolinks (1.3.0)
Using jquery-turbolinks (2.0.1)
Using json (1.8.0)
Using pg (0.16.0)
Using bundler (1.3.2)
Using tilt (1.4.1)
Using sprockets (2.10.0)
Using sprockets-rails (2.0.0)
Using rails (4.0.0)
Using rdoc (3.12.2)
Using sass (3.2.10)
Using sass-rails (4.0.0)
Using sdoc (0.3.20)
Using uglifier (2.2.1)
Your bundle is complete! It was installed into ./vendor/bundle
Cleaning up the bundler cache.
-----> Writing config/database.yml to read from DATABASE_URL
-----> Preparing app for Rails asset pipeline
Detected manifest file, assuming assets were compiled locally
-----> WARNINGS:
Include 'rails_12factor' gem to enable all platform features
See https://devcenter.heroku.com/articles/rails-integration-gems for more information.
You have not declared a Ruby version in your Gemfile.
To set your Ruby version add this line to your Gemfile:
ruby '2.0.0'
# See https://devcenter.heroku.com/articles/ruby-versions for more information."
-----> Discovering process types
Procfile declares types -> (none)
Default types for Ruby/Rails -> console, rake, web, worker
-----> Compiled slug size: 38.5MB
-----> Launching... done, v8
http://calm-mountain-2401.herokuapp.com deployed to Heroku
To git#heroku.com:calm-mountain-2401.git
6e49406..83bf74d master -> master`
Have you attempted precompiling your assets explicitly?
heroku run bundle exec rake assets:precompile
For me worked the solution of pdoherty926.
Try adding the rails_12factor and rails3_serve_static_assets (I'm aware you aren't using Rails 3) gems.

Heroku is bundle installing Sqlite, despite Gemfile specifying for development only

When I attempt to push to heroku with git push heroku master I receive the error:
Counting objects: 55, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (43/43), done.
Writing objects: 100% (43/43), 4.01 KiB, done.
Total 43 (delta 33), reused 0 (delta 0)
-----> Heroku receiving push
-----> Removing .DS_Store files
-----> Ruby/Rails app detected
-----> Installing dependencies using Bundler version 1.1.2
Running: bundle install --without development:test --path vendor/bundle --binstubs bin/ --deployment
Fetching gem metadata from https://rubygems.org/.......
Using rake (0.9.2.2)
Using i18n (0.6.0)
Using multi_json (1.1.0)
Using activesupport (3.2.1)
Using builder (3.0.0)
Using activemodel (3.2.1)
Using erubis (2.7.0)
Using journey (1.0.3)
Using rack (1.4.1)
Using rack-cache (1.2)
Using rack-test (0.6.1)
Using hike (1.2.1)
Using tilt (1.3.3)
Using sprockets (2.1.2)
Using actionpack (3.2.1)
Using mime-types (1.17.2)
Using polyglot (0.3.3)
Using treetop (1.4.10)
Using mail (2.4.3)
Using actionmailer (3.2.1)
Using arel (3.0.2)
Using tzinfo (0.3.32)
Using activerecord (3.2.1)
Using activeresource (3.2.1)
Using bcrypt-ruby (3.0.1)
Using bootstrap-sass (2.0.0)
Using will_paginate (3.0.3)
Using bootstrap-will_paginate (0.0.5)
Using coffee-script-source (1.2.0)
Using execjs (1.3.0)
Using coffee-script (2.2.0)
Using rack-ssl (1.3.2)
Using json (1.6.5)
Using rdoc (3.12)
Using thor (0.14.6)
Using railties (3.2.1)
Using coffee-rails (3.2.2)
Using faker (1.0.1)
Using geocoder (1.1.1)
Using jquery-rails (2.0.0)
Using pg (0.12.2)
Using bundler (1.1.2)
Using rails (3.2.1)
Installing rest-client (1.6.7)
Using sass (3.1.15)
Using sass-rails (3.2.4)
Installing sequel (3.20.0)
Installing sinatra (1.0)
Installing sqlite3 (1.3.5) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb
checking for sqlite3.h... no
sqlite3.h is missing. Try 'port install sqlite3 +universal'
or 'yum install sqlite-devel' and check your shared library search path (the
location where your sqlite3 shared library is located).
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/local/bin/ruby
--with-sqlite3-dir
--without-sqlite3-dir
--with-sqlite3-include
--without-sqlite3-include=${sqlite3-dir}/include
--with-sqlite3-lib
--without-sqlite3-lib=${sqlite3-dir}/lib
--enable-local
--disable-local
Gem files will remain installed in /tmp/build_1t9khulyu1uqj/vendor/bundle/ruby/1.9.1/gems/sqlite3-1.3.5 for inspection.
Results logged to /tmp/build_1t9khulyu1uqj/vendor/bundle/ruby/1.9.1/gems/sqlite3-1.3.5/ext/sqlite3/gem_make.out
An error occured while installing sqlite3 (1.3.5), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.3.5'` succeeds before bundling.
!
! Failed to install gems via Bundler.
!
! Heroku push rejected, failed to compile Ruby/rails app
As you can see, the bundle install excludes development and tests (or so it appears at the top), and my gemfile:
source 'https://rubygems.org'
gem 'rails', '3.2.1'
gem 'bootstrap-sass', '2.0.0'
gem 'bcrypt-ruby', '3.0.1'
gem 'faker', '1.0.1'
gem 'will_paginate', '3.0.3'
gem 'bootstrap-will_paginate', '0.0.5'
gem 'taps'
group :production do
gem 'pg', '0.12.2'
end
group :development do
gem 'sqlite3', '1.3.5'
gem 'annotate', '~> 2.4.1.beta'
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '3.2.4'
gem 'coffee-rails', '3.2.2'
gem 'uglifier', '1.2.3'
end
gem 'jquery-rails', '2.0.0'
group :test, :development do
gem 'rspec-rails', '~> 2.8.rc'
gem 'guard-rspec', '0.5.5'
gem 'guard-spork', '0.3.2'
gem 'spork', '0.9.0'
end
group :test do
gem 'capybara', '1.1.2'
gem 'factory_girl_rails', '1.4.0'
gem 'cucumber-rails', '1.2.1'
gem 'database_cleaner', '0.7.0'
end
#Nifty Scaffold
gem 'nifty-generators', :group => :development
# Location - Geocoder
gem 'geocoder'
gem "mocha", :group => :test
Yet you can still see that the bundle is trying to install sqlite, and thus failing. Any idea what could be going wrong? Many thanks.
I had this problem. After a bit of head-scratching, I realized after I made changes to my Gemfile, I forgot to run git commit, before pushing to heroku.

Resources