Heroku Error Compiling CSS Asset - css

In my latest deploy to Heroku I'm getting this error:
Error compiling css asset
Rack:Timeout:RequestTimeoutException: Request waited 3ms, then ran for longer than 1500ms
/app/vendors/bundle/ruby/2.20/gems-sass-3.4.22/lib/sass/tree/visitors/to_css.rba;67:in 'erase!"
I'm not quite sure what has caused the issue, but I've narrowed it down to a specific deploy where things were working before but were broken after. The only thing I changed were html files and changed the value of a sass variable in one of the stylesheets. I committed to git then deployed to Heroku. I realized then that my jQuery wasn't working on the page, so I then precompiled locally (as I usually do) and deployed . Now the application is throwing that error and exceeding it's available memory. Yet, everything works just fine in development. Anyone have any idea of what went wrong?
EDIT: I should add that the Rack timeout error is thrown by the rack-timeout gem which is designed to stop slow requests and log an error. So this isn't directly the issue, rather a result of an underlying problem that's prevented the page from responding within the allocated amount of time.
Here's the gemfile as requested:
#Use Jasny Bootstrap extension for input mask
gem 'jasny-bootstrap-rails'
#Use for Blog tags
gem 'acts-as-taggable-on', '~> 3.4'
#Use Carrierwave for image upload, fog for AWS S3
gem 'carrierwave'
gem "fog-aws"
gem "mini_magick"
# Use bootstrap will-paginate for pagination styling
gem 'will_paginate-bootstrap'
#Use will paginate for pagination
gem 'will_paginate', '~> 3.1'
#Use BetterLorem for seed text
gem 'betterlorem', '~> 0.1.2'
# Use date_validator gem to validate Event start & end times
gem 'date_validator', '~> 0.9.0'
# Use Bcrpyt for password encryption
gem 'bcrypt', '~> 3.1', '>= 3.1.11'
#Use FontAwesome for icons
gem "font-awesome-rails"
# Use to obfuscate email addresses on site
gem 'actionview-encoded_mail_to', '~> 1.0', '>= 1.0.7'
# Use to show instagram feed
gem 'instagram', '~> 1.1', '>= 1.1.6'
#Use TinyMCE to edit html content in posts
gem 'tinymce-rails'
# Use Jquery-turbolinks to fix turbolink issue
gem 'jquery-turbolinks'
# Timesout request that take longer than 15 seconds
gem "rack-timeout"
#Breadcrumb navigation
gem "breadcrumbs_on_rails"
# Use Gibbon for Mailchimp API navigation
gem 'gibbon', '~> 2.2', '>= 2.2.4'
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
gem 'pry', '~> 0.10.3'
# Use sqlite3 as the database for Active Record
gem 'sqlite3', '~> 1.3', '>= 1.3.11'
# Use for storing environmental variables
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'
# Tracks memory usage of each gem
gem 'derailed'
# 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
gem 'minitest', '~> 5.8', '>= 5.8.4'
gem 'mini_backtrace', '~> 0.1.3'
gem 'guard-minitest', '~> 2.4', '>= 2.4.4'
gem 'guard'
gem 'minitest-reporters', '~> 1.1', '>= 1.1.8'
end
group :production do
gem 'pg', '~> 0.18.4'
gem 'rails_12factor', '~> 0.0.3'
gem 'puma'
end

Related

Why am I getting this error in my rails solidus app after installing bootstrap?

I am trying to set up a solidus app with custom css using bootstrap-sass. (I am following this tutorial)
Prior to getting this error, the page would load just fine but none of the bootstrap css would load correctly. This error started after I added
#= require bootstrap_sprockets
#= require_tree
to my all.coffee file
and adding
gem 'sassc-rails'
to my Gemfile
the complete all.sass file:
#import "bootstrap-sprockets"
#import "bootstrap"
the complete all.coffee file:
#= require jquery
#= require jquery_ujs
#= require spree
#= require bootstrap_sprockets
#= require_tree
the complete Gemfile:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.0.0'
# Use postgresql as the database for Active Record
gem 'pg', '~> 0.18'
# Use Puma as the app server
gem 'puma', '~> 3.0'
# 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.2'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
gem 'bootstrap-sass'
gem 'sassc-rails'
gem 'solidus'
gem 'solidus_auth_devise'
gem 'deface'
# Use jquery as the JavaScript library
gem 'jquery-rails'
# 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.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# 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', platform: :mri
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
gem 'web-console'
gem 'listen', '~> 3.0.5'
# 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
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
when I run the server I get the following error:
Error: Function very-light finished without #return
on line 38:34 of ../../.rvm/gems/ruby-2.6.3/gems/solidus_backend-2.2.2/app/assets/stylesheets/spree/backend/globals/_variables.scss, in function `very-light`
from line 38:34 of ../../.rvm/gems/ruby-2.6.3/gems/solidus_backend-2.2.2/app/assets/stylesheets/spree/backend/globals/_variables.scss
from line 6:9 of ../../.rvm/gems/ruby-2.6.3/gems/solidus_backend-2.2.2/app/assets/stylesheets/spree/backend/spree_admin.scss
>> $color-border: very-light($color-3, 12) !default;
I'm not sure what exactly I need to do to fix this. I've made sure that I have the required gems for bootstrap-sass in my Gemfile and I've tried running bundle update.
the latest sassc-rails gem implemented via sassc, wich requires all CSS functions should ensure that they do not end without a #return statement.
and solidus fix it after v2.9, you can see it on https://github.com/solidusio/solidus/commit/aeba736e742eaf39e45b294433e33d663ac66f24

Bootstrap is not styling anything with Ruby on Rails

I am using Bootstrap for the first time and it is not styling anything. I have already applied the answers from Bootstrap is not styling anything
and still no luck.
I have #import "bootstrap"; in my stylesheet
I also have the appropriate gems in my Gemfile. Here it is:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.5'
# Use sqlite3 as the database for Active Record
group :development,:test do
gem 'sqlite3'
end
group :production do
gem 'pg'
end
gem 'autoprefixer-rails'
group :assets do
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'
gem 'bootstrap-sass', '~> 3.2.0'
end
# 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]
1) Add
config.assets.precompile += %w(*.png *.jpg *.jpeg *.gif)
to application.rb (inside the class)
2) Add #import 'bootstrap'; to the top line of a new CSS file.
Rails 4 does not use an assets group in Gemfile, So remove that & then edit your application.css to include following:
#import "bootstrap-sprockets";
#import "bootstrap";
Note: "bootstrap-sprockets" must be imported before "bootstrap" and "bootstrap/variables"
Now add require Bootstrap Javascripts in app/assets/javascripts/application.js:
//= require jquery
//= require bootstrap-sprockets

rspec-rails generator doesn't create spec/rails_helper.rb

I created new Rails app, then added gem 'rspec-rails' to Gemfile, bundle install-ed, and launched
rails g rspec:install
create .rspec
create spec
create spec/spec_helper.rb
Why it didn't create spec/rails_helper.rb ?
My Gemfile is being generated with new Rails aplication with empty lines and comments removed. I only added the last line to it.
source 'https://rubygems.org'
gem 'rails', '4.0.3'
gem 'sqlite3'
gem 'sass-rails', '~> 4.0.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 1.2'
group :doc do
gem 'sdoc', require: false
end
gem 'rspec-rails'
rails_helper.rb is new to Rspec Rails 3.x. You may be running an earlier version. Check your Gemfile.lock or run bundle list | grep rspec-rails to see which version you're running.
I think it's because it needs to be in both :development and :test
It should be:
group :development, :test do
gem 'rspec-rails', '~> 6.0.0'
end

How to create a postfix button in Twitter-bootstrap for rails?

I recently switched from Foundation Zurb , to Twitter bootstrap for Rails.
And in Foundation Zurb , the postfix button was already provided within the existing options, which is not the case for twitter-bootstrap-rails.
I tried doing stuff like this
<div class="col-sm-2">
<f.text_area :search, :class => "text_area">
<%= button_tag "name", type: 'button', class: "btn btn-info"%>
</div>
But I could not seem to even go near it.
Can anyone provide some useful method to do this?
Ps : For those of you who do not know what is a postfix button, it is exactly as the button that is in Youtube for instance, Next to the search bar.
Check this link and scroll down to Pre/post fix buttons ,and you'll see what I am talking about.
======================================
A look into my gemfile as requested by #Sadik
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.2'
# Use mysql as the database for Active Record
gem 'mysql2'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
# Use SCSS for stylesheets
gem 'less-rails'
# 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'
# User ActiveModel act_as_list
gem 'acts_as_list', '~> 0.4.0'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
#Use ActiveModel geocoded_by :address after_validation :geocode
gem 'geocoder'
#User SCSSS for Stylesheets
gem 'twitter-bootstrap-rails', :git => 'git://github.com/seyhunak/twitter-bootstrap-rails.git'
===============================================
Update #1 : Solved
Thanks to the answer below, but not really the answer, thanks to the comment that specified that I should update to the right version of twitter-bootstrap.
If you are facing the same problem, Go to your gemfile and write
gem 'twitter-bootstrap-rails', github: 'seyhunak/twitter-bootstrap-rails', branch: 'bootstrap3'
And bundle install and Absolutely then rails g bootstrap:install less to the end of story that you already know.
For further support, check this link
I guess Bootstrap input group addon is what you are looking for change your code to
<div class="col-sm-2 form-group">
<div class="input-group">
<%= f.text_field :search, :class => "form-control" %>
<span class="input-group-addon">
<span class="glyphicon glyphicon-search"></span>
</span>
</div>
</div>
Here's the jsfiddle: http://jsfiddle.net/monideeps99/2Ag3g/

gem sqlite not load in gemfile rails 4

i using rails 4 and ruby 2.0, but when i running rails s i in console i get some error like this :
/home/user/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-4.0.1/lib/active_record/connection_adapters/connection_specification.rb:58:in `rescue in resolve_hash_connection': Specified 'sqlite3' for database adapter, but the gem is not loaded. Add `gem 'sqlite3'` to your Gemfile. (Gem::LoadError)
why error? i alredy put gem 'sqlite3' in gemfile and run bundle install but still error, this my gemfile :
ruby '2.0.0'
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.1'
# 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'
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
gem 'devise'
gem "twitter-bootstrap-rails"
gem 'carrierwave'
# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.1.2'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano', group: :development
group :development do
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
end
# Use debugger
gem 'debugger', group: [:development, :test]
gem 'pg', group: [:production]
gem 'rails_12factor'
and this my database.yml :
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
adapter: sqlite3
database: db/test.sqlite3
pool: 5
timeout: 5000
production:
adapter: sqlite3
database: db/production.sqlite3
pool: 5
timeout: 5000
if i wrong please tell me?? thanks
Try going into your gemfile.lock file and changing the sqlite3 version to sqlite3 (1.3.8) and then re-bundle install/bundle update

Resources