Less parser error while precompiling assets rails - ruby-on-rails

Here is my Gemfile.
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.1'
# Use mysql as the database for Active Record
gem 'mysql2'
# Use SCSS for stylesheets
gem 'pg'
gem 'rails_12factor', group: :production
gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'geocoder'
gem 'geocomplete_rails'
gem 'google_timezone'
gem 'jquery-rails'
gem 'tag-it-rails'
gem 'turbolinks'
gem 'rails4-autocomplete'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'will_paginate', '~> 3.0'
gem 'devise'
gem 'pry'
gem 'friendly_id'
gem "paperclip"
gem 'aws-sdk'
gem 'best_in_place'
gem "nested_form"
gem 'acts-as-taggable-on'
gem 'bootstrap-timepicker-rails'
gem 'mandrill_mailer'
gem 'bootstrap-sass'
gem "font-awesome-rails"
gem 'phony_rails'
gem 'twilio-ruby'
gem 'gmaps4rails'
gem "stripe"
gem "humanize"
gem "prawn"
gem 'activeadmin', github: 'gregbell/active_admin'
gem 'spring', group: :development
gem "therubyracer"
gem "less-rails"
gem "twitter-bootstrap-rails"
and I have this in my application.rb file
config.assets.paths << File.join(Rails.root, "/vendor/pages")
I have both scss and less files in my assets when I try to precompile my assets with rake assets:precompile I get this error
Less::ParseError: .padding-right is undefined
what I am doing wrong here any help?

I was able to precompile my assets in production mode with
RAILS_ENV=production rake assets:precompile
I am not sure why it worked may be because of rails_12factor gem but it solved my problem.

Related

Why is bundler looking for mysql2 -v '0.4.4' --source 'https://rubygems.org/'

Below is my Gemfile but i haven't specified the mysql2 version but for some reason it's looking for 0.4.4. It must be a dependency of another gem. I was just assigned thAny ideas?
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.6'
# Use sqlite3 as the database for Active Record
gem 'mysql2', group: :production
# 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'
gem 'active_model_serializers', '~> 0.10.0.rc5'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'acts_as_better_tree'
gem 'rest-client', '~> 1.8'
gem 'apipie-rails', :github => 'Apipie/apipie-rails'
gem 'devise'
gem 'petergate'
gem 'pry-rails'
gem 'annotate'
gem 'slim-rails'
gem 'bootstrap-sass'
gem 'font-awesome-sass'
gem 'carrierwave'
gem 'carrierwave-base64'
gem 'carrierwave-aws'
gem 'authorizenet'
gem 'figaro'
gem 'roo', '~> 2.3.2'
gem 'roo-xls', '~> 1.0'
gem 'mini_magick', '~> 4.5'
gem 'html5shiv-rails'
gem 'cocoon'
gem 'will_paginate'
gem 'wicked_pdf'
gem 'wkhtmltopdf_binary'
gem "minitest-rails"
gem "minitest-reporters"
gem 'airbrake', '~> 5.6'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development 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'
gem 'capistrano'
gem 'capistrano-passenger'
gem 'capistrano-bundler'
gem 'capistrano-rails'
gem 'capistrano-rails-console'
gem 'capistrano-rvm'
gem 'better_errors'
gem 'pry'
end
group :development, :test do
gem 'sqlite3'
gem 'byebug'
end
$ gem dependency mysql2 --reverse-dependencies
It'll list each version of mysql2 and then the gems that depend on that version.
I believe the problem is with the rails version and mysql2 version. Change the Gemfile line that contains gem 'mysql2' to gem 'mysql2', '~> 0.4.0'
I have gem 'rails', '4.2.6' installed but apparently there is some compile error with mysql2 and that version of rails.
"For Rails 4.x please pin the gem to mysql2 '~> 0.4.0'" - sodabrew
After doing this the bundle install ran and I was able to run rails c without errors.

Deploying Rails App with webpack to heroku

I created my rails with this template that included webpack. But i still wrote my javascript code in app/assets/javascript. Now I am trying to deploy my app to heroku and it keeps failing. I get this error
remote: /tmp/build_6f0656280cbbda40c5832ccb79fc1783/vendor/bundle/ruby/2.3.0/gems/bundler-1.15.2/lib/bundler/rubygems_integration.rb:432:in `block in replace_bin_path': can't find executable webpack for gem webpacker (Gem::Exception)
The main error seems to be "cant find executable webpack for gem webpacker". I have no idea how to solve it. This is my gemfile
source 'https://rubygems.org'
ruby '2.3.5'
gem 'figaro'
gem 'jbuilder', '~> 2.0'
gem 'puma'
gem 'rails', '5.1.4'
gem 'redis'
gem 'cloudinary'
gem 'carrierwave', '~> 1.2'
gem 'rails_admin', '~> 1.2'
group :production do
gem 'pg', '~> 0.20'
end
gem 'autoprefixer-rails'
gem 'bootstrap-sass'
gem 'jquery-rails'
gem 'font-awesome-sass'
gem 'sass-rails'
gem 'simple_form'
gem 'turbolinks', '~> 5.0.0'
gem 'coffee-rails'
gem 'uglifier'
gem 'webpacker'
gem 'devise'
gem 'ransack'
gem 'trix'
gem "letter_opener", group: :development
group :development do
gem 'web-console', '>= 3.3.0'
gem 'sqlite3'
end
group :development, :test do
# gem 'binding_of_caller'
# gem 'better_errors'
gem 'pry-byebug'
gem 'pry-rails'
gem 'listen', '~> 3.0.5'
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end
Breaking changes in 3.3.0
https://github.com/rails/webpacker/blob/master/CHANGELOG.md#330---2018-03-03
bundle exec rails webpacker:binstubs

Ruby version 2.2.5 but your Gem file specified 2.1.2

I already tried to update gem bundle and also try to pick gem 2.1.2 but ruby is not supporting them. Here is the error message:
error message
Gemfile:
source 'https://rubygems.org'
ruby '2.1.2'
gem 'rails', '4.2.4'
gem 'pry-rails'
gem 'pg'
gem 'bcrypt', require: 'bcrypt'
gem 'friendly_id'
gem 'sass-rails', '~> 5.0'
gem 'bootstrap-sass'
gem 'uglifier', '>= 1.3.0'
gem 'jquery-rails'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'puma'
gem 'rails_12factor', group: :production
gem 'newrelic_rpm'
gem 'rack-timeout'
gem 'rmagick'
gem 'aws-sdk'
gem 'paperclip'
group :development, :test do
gem 'byebug'
end
group :development do
gem 'web-console', '~> 2.0'
gem 'binding_of_caller'
gem 'better_errors'
gem 'annotate'
gem 'dotenv-rails'
gem 'spring'
end
It seems that you have defined the ruby version for your project in the Gemfile. If you comment it out then, your app could use the system version of Ruby. If you need further help please publish the code in Gemfile.

undefined method `[]' for "font":Sass::Script::Value::String

I am running my rails application I encountered the above error.
I guess it has something to do with sass rails and font awesome.
Here is my gemfile
source 'https://rubygems.org'
ruby '2.2.3'
gem 'rails', '4.2.6'
gem 'jquery-rails'
gem 'jquery-turbolinks'
gem 'jquery-ui-rails'
gem 'devise'
gem 'simple_form'
gem 'will_paginate'
gem 'bootstrap-will_paginate'
#gem 'activerecord-reputation-system', require: 'reputation_system'
gem 'activerecord-reputation-system', github: 'NARKOZ/activerecord-reputation-system', branch: 'rails4'
gem 'acts-as-taggable-on'
gem 'randumb'
gem 'turbolinks'
gem 'mobu'
#gem 'font_assets' rails 3?
#gem 'font-awesome-rails', '4.2' #'3.1.1.0'
gem 'font-awesome-rails'
gem 'protected_attributes' #for attr_accesible instead of strong params..
#this is active admin gem
#gem 'activeadmin', github: 'activeadmin'
gem 'activeadmin', '~> 1.0.0.pre2'
gem 'rack-cors', :require => 'rack/cors'
#group :assets do
gem 'sass-rails', '~> 5.0'
gem 'coffee-rails' #, '~> 3.2.1'
gem 'uglifier' #, '>= 1.0.3'
gem 'bootstrap-sass'
gem 'tzinfo-data' #rails 4 stuff
gem 'pg'
# this gem is used for pagination
#gem 'kaminari'
group :production do
#gem 'heroku-deflater' need rails 4 fix, this gem helps to optimize app performance
gem 'unicorn'
gem 'rails_12factor'
end
group :development, :test do
gem 'better_errors' #need ruby 2.0
end
I tried to update sass rails and sprockets but of no use.I have tried to use #import fontawesome in a stylesheet other than application.css.
In my case the trouble was a result of custom fonts.
Solution was to remove the 'font' parameter from the asset-url helper.
previous:
asset-url('custom-webfont.svg', 'font') format('svg');
new
asset-url('custom-webfont.svg') format('svg');

Heroku / Rails 4 sqlite3 error on precompile

My Heroku deploy is failing on the Running: rake assets:precompile step with the follow:
Specified 'sqlite3' for database adapter, but the gem is not loaded. Add `gem 'sqlite3'` to your Gemfile.
My Gemfile has 'sqlite3' only in the development group, as you can see:
source 'https://rubygems.org'
ruby '2.0.0'
gem 'rails', '4.0.1'
gem 'sass-rails', '~> 4.0.0'
gem "compass-rails", "~> 2.0.alpha.0"
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 1.2'
gem 'devise'
gem 'figaro'
gem 'haml-rails'
gem 'sendgrid'
gem 'simple_form'
gem 'omniauth-twitter'
gem 'omniauth-facebook'
gem "cancan", :git => "git://github.com/ryanb/cancan.git", :branch => "2.0"
gem 'roadie', '2.4.2'
group :development do
gem 'better_errors'
gem 'binding_of_caller', :platforms=>[:mri_19, :mri_20, :rbx]
gem 'guard-bundler'
gem 'guard-rails'
gem 'guard-rspec'
gem 'guard-livereload'
gem 'html2haml'
gem 'quiet_assets'
gem 'rails_layout'
gem 'rb-fchange', :require=>false
gem 'rb-fsevent', :require=>false
gem 'rb-inotify', :require=>false
gem 'debugger'
end
group :development, :test do
gem 'factory_girl_rails'
gem 'rspec-rails'
gem 'zeus'
gem 'sqlite3'
end
group :test do
gem 'capybara'
gem 'capybara-webkit'
gem 'database_cleaner', '1.0.1'
gem 'email_spec'
end
group :production do
gem 'unicorn'
gem 'passenger'
gem 'rails_12factor'
end
Additionally, I am using the rails_12factor gem and user-env-compile thing... neither helped with the error. I've also added RACK_ENV=production and RAILS_ENV=production config vars to the Heroku environment, to be safe.
Seems like it Heroku is firing up the development environment when precompiling. Any ideas why?
On Heroku, I've never gotten away without having pg in my production group.
group :production do
gem 'pg'
gem 'rails_12factor'
end
Assuming you're using that database in prod, of course.

Resources