Pushing to Heroku fails (Devise) - ruby-on-rails

So I'm having issues pushing to Heroku I run
git push heroku master
It starts pushing, then fails with this error
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
rake aborted!
NameError: uninitialized constant Devise
/tmp/build_e47e5acc3405b13038fee9893d25b35a/config/initializers/devise.rb:3:in `<top (required)>'
Here's my gemfile
gem 'rails', '4.2.4'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'spring', group: :development
gem 'byebug', group: :development
gem 'web-console', '~> 2.0', group: :development
gem 'bootstrap-sass', '~> 3.3.5.1'
gem 'devise', '~> 3.5.2'
gem 'paperclip', '~> 4.3.1'
gem 'aws-sdk', '< 2.0'
gem 'jquery-turbolinks'
gem 'masonry-rails', '~> 0.2.4'
gem 'will_paginate', '~> 3.0.7'
gem 'will_paginate-bootstrap', '~> 1.0.1'
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pg', '0.17.1'
gem 'rails_12factor', '0.0.2'
end
It appears Devise is the culprit, would I have to add Devise to " group :production do"? I haven't assigned it to any particular group, but it is in the Gemfile.
Thanks guys.
Edit: I've added "Devise" to :production do, and still the same result.

Related

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.

How can i solve Capistrano command error, cap production deploy?

I am on windows machine while using the command line i get this error
"(Backtrace restricted to imported tasks) cap aborted! LoadError: cannot load such file -- capistrano/passenger C:/Sites/Buy/Capfile:23:in `'
(See full trace by running task with --trace)"
And on git bash with the same command i have this error.
" cap production deploy C:/tools/ruby21/lib/ruby/2.1.0/rubygems.rb:235:in bin_path': can't find gem capistrano ([">= 0.a"]) (Gem::GemNotFoundException)
from C:/RailsInstaller/Ruby2.1.0/bin/cap:22:in'"
The gems i am using.
gem 'rails', '4.1.8'
gem 'sqlite3'
gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'therubyracer', platforms: :ruby
gem 'rails_12factor', group: :production
gem 'protected_attributes', '~> 1.1', '>= 1.1.3'
gem 'rake', '~> 10.5'
gem 'rake-compiler', '~> 0.9.5'
gem 'rspec', '~> 3.4'
gem 'omniauth-digitalocean', '~> 0.2.0'
gem 'devise', '~> 3.5', '>= 3.5.6'
gem 'bootstrap-sass'
gem 'autoprefixer-rails', '~> 6.3', '>= 6.3.1'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'bcrypt', '~> 3.1.7'
gem 'pg'
gem "cf-autoconfig", "~> 0.2.1"
gem 'omniauth', '~> 1.3', '>= 1.3.1'
gem 'json', '~> 1.8', '>= 1.8.3'
gem 'omniauth-twitter', '~> 1.2', '>= 1.2.1'
gem 'omniauth-facebook', '~> 3.0'
platforms :ruby do
gem 'unicorn'
end
group :development do
gem 'capistrano', '~> 3.4'
gem 'capistrano-bundler', '~> 1.1', '>= 1.1.4'
gem 'capistrano-rbenv', '~> 2.0', '>= 2.0.4'
gem 'capistrano-rails', group: :development
end
gem 'tzinfo-data', platforms: [:mingw, :mswin]
I had same error but with:
capistrano/rbenv
I commit the line (in your case 23) in Gapfile and the deploy work with no problems.
You may have included a line in Capfile that is:
require 'capistrano/passenger'
Please remove this line and try again cap production deploy:initial
The new capistrano requires the passenger file but I think you are not using passenger but webrick, puma or unicorn. So that is the reason your cap cannot find passenger.
For more info on deploying rails app to digital ocean ubuntu server with capistrano, puma, nginx complete tutorial available at:
http://sulmanbaig.com/blog/deploy-on-digitalocean-rails-puma-nginx

Issue with Gem file

I'm trying to install active admin which I was partly successful with. However, I want to use the '0-6-stable' and not the "1.0.0.pre2" version. When I changed my gem file to reflect my change, I get the following error message:
Resolving dependencies...
Bundler could not find compatible versions for gem "formtastic":
In Gemfile:
activeadmin (>= 0) ruby depends on
formtastic (~> 2.0) ruby
formtastic (3.2.0.pre)
Now, I've gotten this message before and I would just delete my Gemfile.lock but it doesn't seem like that is working.
Copy of my gem file:
source 'http://rubygems.org'
ruby '2.2.1'
gem 'ransack', github: 'activerecord-hackery/ransack'
gem 'inherited_resources', github: 'josevalim/inherited_resources'
gem 'formtastic', github: 'justinfrench/formtastic'
gem 'rails', '~> 4.2', '>= 4.2.5'
gem 'railties', '~> 4.2', '>= 4.2.5'
gem 'sqlite3', group: :development
gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails', '~> 4.0', '>= 4.0.5'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'rails_12factor', group: :production
gem 'pg', group: :production
gem 'activeadmin', github: 'activeadmin', branch: '0-6-stable'
#gem 'will_paginate', '~> 3.0'
#gem 'will_paginate-bootstrap'
gem 'carrierwave'
gem "fog"
gem "figaro"
gem 'execjs'
gem 'tzinfo-data', platforms: [:mingw, :mswin]
gem "mini_magick"
gem 'devise'
gem 'searchkick'
group :development, :test do
gem 'rspec-rails', '~> 3.0'
end
The reason I want to use the most stable version of active admin is because I'm getting "NoMethodError in Admin::AdminUsersController#index" when I select "Admin Users" I hoping that using the stable version will correct this issue.
EDIT: The ActiveAdmin Issue: https://github.com/activeadmin/activeadmin/issues/4249
You can't use the 0-6-stable branch, if you use rails >= 4.x, 0-6-stable works only with rails <= 3.x.
This mean's your Gemfile need to look like this:
source 'http://rubygems.org'
ruby '2.2.1'
gem 'rails', '~> 4.2', '>= 4.2.5'
gem 'railties', '~> 4.2', '>= 4.2.5'
gem 'sqlite3', group: :development
gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails', '~> 4.0', '>= 4.0.5'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'rails_12factor', group: :production
gem 'pg', group: :production
gem 'activeadmin', github: 'activeadmin'
#gem 'will_paginate', '~> 3.0'
#gem 'will_paginate-bootstrap'
gem 'carrierwave'
gem "fog"
gem "figaro"
gem 'execjs'
gem 'tzinfo-data', platforms: [:mingw, :mswin]
gem "mini_magick"
gem 'devise'
gem 'searchkick'
group :development, :test do
gem 'rspec-rails', '~> 3.0'
end
From the ActiveAdmin point of view there is no need to use ransack, inherited_resources and formtastic from github.
1: remove Gemfile.lock
2: Add gem 'jquery-rails'
3: add gem 'formtastic'
4: Run bundle install
Still if you have any issue in bundle Github Active Admin ,I would like to say go with rails 3.2.
Hope this help you !!!

unable to start rails server without normalize-scss gem

After commenting out normalize-scss in my Gemfile and running rails -s, I get:
bin/rails:6: warning: already initialized constant APP_PATH
/Users/ItsMe/foo/bar/bin/rails:6: warning: previous definition of APP_PATH was here
Adding the gem back in lets me run the server.
...why? I've already checked bin/rails:6, and APP_PATH looks totally fine.
Gemfile:
source 'https://rubygems.org'
gem 'rails', '4.2.4'
gem 'pg', '~> 0.18.3'
gem 'sass-rails', '~> 5.0'
gem 'compass-rails', '~> 2.0', '>= 2.0.5'
# gem 'normalize-scss', '~> 3.0', '>= 3.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
# gem 'therubyracer', platforms: :ruby
gem 'jquery-rails'
# gem 'bootstrap-sass', '~> 3.3', '>= 3.3.5.1'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'figaro', '~> 1.1', '>= 1.1.1'
gem 'susy', '~> 2.2', '>= 2.2.6'
gem 'breakpoint', '~> 2.5'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
group :development, :test do
gem 'byebug'
gem 'web-console', '~> 2.0'
gem 'spring'
end
group :test do
gem 'minitest-reporters', '1.0.5'
gem 'mini_backtrace', '0.1.3'
gem 'guard-minitest', '2.3.1'
end
group :production do
gem 'rails_12factor', '~> 0.0.3'
end
Solved it. I had required the gem in config/application.rb. Removed it, and solved.

Resources