Solidus Installation Failure - ruby-on-rails

So Solidus is a fork of Spree and Spree is no longer maintained.
Am following the instructions on the Solidus's Github page (https://github.com/solidusio/solidus) to install it. And am stuck at this command bundle exec rails g spree:install this command raises the following error:
/Users/user1/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/handlebars_assets-0.19.1/lib/handlebars_assets.rb:20:in 'block in register_extensions': undefined method 'register_engine' for nil:NilClass (NoMethodError)
Not sure if this might help but before trying to install Solidus I was working on a Spree project.
Also, here is my Gemfile:
source 'https://rubygems.org'
# Solidus E-Commerce
gem 'solidus'
gem 'solidus_auth_devise'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.4'
# 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
# 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'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
Any help is really appreciated.

Update:
This is a known bug with handlebars-assets gem, which is resolved in master.
Adding the line :
gem 'handlebars_assets', github: 'leshill/handlebars_assets'
to your Gemfile will solve your problem until a new version contains the relevant fix.
Move the lines :
gem 'solidus'
gem 'solidus_auth_devise'
below gem 'rails', '4.2.4' because the former depends on the latter.

We've released a new version of solidus (v1.1.1) which locks sprockets-rails to 2.x to fix this issue.
https://github.com/solidusio/solidus/releases/tag/v1.1.1
In lieu of upgrading you can also specify the older sprockets-rails version in your Gemfile
gem "sprockets-rails", "~> 2.3"

Related

I'm getting this error: Specified 'sqlite3' for database adapter, but the gem is not loaded

I am trying to run a Ruby on Rails app on Cloud 9 with the following command:
rails s -p $PORT -b $IP
and I'm getting an error that tells me I don't have sqlite3 in the gem file when I do. This only happened after I pushed my code to Heroku and now it doesn't run in the console any more.
I already tried 'bundle install' and 'bundle update', I also tried to manually install sqlite3 by running 'gem install sqlite3', none of these solved my problem. I also started going through all the steps all over again to see if that issue pops up again, and it does.
source 'https://rubygems.org'
ruby '2.4.1'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.10'
# 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 Haml as the templating library
gem 'haml'
# 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
gem 'themoviedb'
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
gem 'rspec-rails'
gem 'guard-rspec'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# 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'
end
group :production do
gem 'pg', '~> 0.21' # for Heroku deployment
gem 'rails_12factor'
end
(Posted on behalf of the question author).
I fixed it eventually, what happened was the version in Gemfile.lock was 'sqlite3 (1.4.0)' but the version I needed was 'sqlite3 (1.3.13)'. I changed the version and ran 'rake db:migrate' and 'rake db:seed' again and now it's working.
Your app is probably running the production environment on Heroku, but your Gemfile only includes sqlite3 in the development & test groups. Move sqlite3 out of the groups so that it is available in all environments and redeploy.
Something wrong with sqlite3 versions > 1.4.0 with Rails 5. Mention sqlite3 version explicitly in Gemfile with v1.3.11 or v1.3.13.
(gem 'sqlite3', '~> 1.3.11')

Ruby on Rails app deployed to heroku but Application error?

everyone actually i am new to ROR and struggling with debugging and especially reading and understanding heroku logs
I am using cloud 9 as an ide for development
I have made a basic note app and after successful build i deployed it to heroku but when i open the app link it says application error
can someone please help me out thank you !
Ruby version
ruby 2.3.4p301 (2017-03-30 revision 58214) [x86_64-linux]
Rails version
Rails 4.2.5
Gemfile
source 'https://rubygems.org'
ruby '2.5.1'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.5'
# Use sqlite3 as the database for Active Record
# Use SCSS for stylesheets
gem 'bootstrap-sass', '~> 3.3.7'
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
# 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
gem 'sqlite3'
# 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'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
group :production do
gem 'pg'
gem 'rails_12factor'
end
Heroku logs -n 300
https://drive.google.com/file/d/1-evm_rnjGHiblHGckLmGwGcmOv5yBd6-/view?usp=sharing
thanks guys ! Sometimes the solution is really simple but it can't be sensed. I solved the issue just by adding version of pg gem in group production [gem 'pg', '~> 0.20']

Rails 5: rails s vs. bundle exec rails s

I'm starting a project on Rails 5 for the first time and I was curious why running 'rails s' when I was on Rails 4 worked fine, but now that I'm on Rails 5 I need to preface it with 'bundle exec' in order to run the command properly.
Below is my Gemfile. Again, everything works normally if I preface all my rails commands with. I'm just curious if anyone else experiencing this or if someone can give me some insight as to why this is happening?
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.0.0', '>= 5.0.0.1'
# 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
# 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'
gem 'bootstrap', '~> 4.0.0.alpha3'
source 'https://rails-assets.org' do
gem 'rails-assets-tether', '>= 1.1.0'
end
gem "paperclip", "~> 5.0.0"
gem "browser"
# 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]
It sounds like the rails command you have installed globally is rails 4 and it's the reason "it doesn't run properly" like you say. When you run bundle exec then it uses the rails commands from the current Gemfile, since you have rails 5 in your Gemfile then it works properly.
I'd recommend using either RVM or rbenv, I personally like RVM since it switches automatically to the gemset of the ruby version specified in my Gemfile.
Example, when I cd into the directory of my project I get a message like:
RVM used your Gemfile for selecting Ruby, it is all fine - Heroku does that too.
Using bundle exec guarantees that the program is run with the environment specified in the gemfile, which hopefully means it is the environment that the creators of the program want it to be run in, which hopefully means it should run correctly no matter what weird setup you have on your computer.
Reference: Use bundle exec rake or just rake?

How to solve `rails generate ...` commands hanging?

Just installed and successfully add gem "twitter-bootstrap-rails" to gemfile and bundled successfully; Bundle complete! with twitter-bootstrap-rails 3.2.0. Then trying, as instructed by gem documentation, to; rails generate bootstrap:install static but the command just hangs.
I checked whether other rails generate commands work and indeed they hang also. Can anyone help me diagnose and fix the issue? I'm unsure where to look to try to find out what the problem is under the hood. I'm running Rails 4.2.1 and Ruby 2.2.1, here is my gemfile:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.1'
# Use postgresql as the database for Active Record
gem 'pg'
# 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
gem 'devise'
gem "twitter-bootstrap-rails"
# 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'
# 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 'rspec-rails'
end
group :test do
gem 'capybara'
gem 'pry-rails'
gem 'shoulda-matchers', github: 'thoughtbot/shoulda-matchers'
end
After lots of searching this link suggested spring was the issue and to try a spring stop. Upon running this and calling generate again everything worked just fine. Thank you spring stop, now to go and learn some more about what spring actually is and does!

Aptana RadRails undefined method 'source'

I recently installed linux and am trying my hand at ruby development. I have successfully installed rvm, along with rails and sqlite3. I created a test application in Aptana RadRails to make sure my install worked correctly.
Unfortunately, when I try to run my app I receive this error:
/home/Daniel/Workspace/Dan_Test/Gemfile:1:in <main>': undefined
methodsource' for main:Object (NoMethodError)
I cannot figure out why I am receiving this error. The application is the default created under 'rails new'; I have added no new code. I have also run bundle install so the appropriate gems should be present.
Thank you very much for your help!
below is the gemfile:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# 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
# 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]
Forgive me; the issue was with how I installed rvm. I set a path that didn't exist in the bashrc: source /etc/provile.d/rvm.sh, instead of /etc/profile.d/rvm.sh. This seems to have caused the majority of my issues.
Thank you for your patience!

Resources