Error Installing Spree in a Rails Project - spree

I get the error below when trying to install Spree within a new Rails project. I have Rails version 4.2.5 installed, and Ruby version 2.3.0p0
$ spree install --auto-accept
[WARNING] Spree CMD Installer is deprecated. Please follow installation instructions at https://github.com/spree/spree#getting-started
/usr/local/rvm/rubies/ruby- 2.3.0/lib/ruby/2.3.0/rubygems/specification.rb:2158:in `method_missing': undefined method `this' for #<Gem::Specification:0x3fcb12418c74 activesupport-5.0.0.1> (NoMethodError)
from /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/specification.rb:1057:in `find_active_stub_by_path'
from /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:64:in `require'
from /usr/local/rvm/gems/ruby-2.3.0/gems/activesupport-5.0.0.1/lib/active_support/core_ext/string.rb:1:in `<top (required)>'
from /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in `require'
from /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in `rescue in require'
from /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:40:in `require'
from /usr/local/rvm/gems/ruby-2.3.0/gems/spree_cmd-3.1.1/lib/spree_cmd/installer.rb:2:in `<top (required)>'
from /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/rvm/gems/ruby-2.3.0/gems/spree_cmd-3.1.1/lib/spree_cmd.rb:14:in `<top (required)>'
from /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/rvm/gems/ruby-2.3.0/gems/spree_cmd-3.1.1/bin/spree:2:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.3.0/bin/spree:23:in `load'
from /usr/local/rvm/gems/ruby-2.3.0/bin/spree:23:in `<main>'
from /usr/local/rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
from /usr/local/rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'`

Hey if you want to use spree 3.1 then it
Required rails rails (~> 4.2.6)
I have tested spree 3.0 stable with 4.2.2 it might work with your version so to create app with that you can follow https://github.com/spree/spree/tree/3-0-stable

as per the first line of logs
Spree CMD Installer is deprecated. Please follow installation instructions at https://github.com/spree/spree#getting-started
which means ..
$ spree install --auto-accept
wont work..!!
Upgrade rails to 4.2.6 and then follow the steps.
Add Spree gems to your Gemfile:
gem 'spree', '~> 3.1.0'
gem 'spree_auth_devise', '~> 3.1.0'
gem 'spree_gateway', '~> 3.1.0'
Run bundle install
Use the install generators to set up Spree:
rails g spree:install --user_class=Spree::User
rails g spree:auth:install
rails g spree_gateway:install
and finally
rails g spree:install

Related

How to start rails console in AWS OpsWorks

Recently an app was upgraded to rails 6 and it uses Apache and Passenger at AWS Opsworks
I would like to know how to start the rails console in production?
deploy#apricots:/srv/www/app_name/current$ bundle exec rails c production
Traceback (most recent call last):
9: from /usr/local/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:55:in `require'
8: from /usr/local/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:55:in `require'
7: from /usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.0.2/lib/bundler/setup.rb:10:in `<top (required)>'
6: from /usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.0.2/lib/bundler.rb:107:in `setup'
5: from /usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.0.2/lib/bundler/runtime.rb:26:in `setup'
4: from /usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.0.2/lib/bundler/runtime.rb:26:in `map'
3: from /usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.0.2/lib/bundler/spec_set.rb:148:in `each'
2: from /usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.0.2/lib/bundler/spec_set.rb:148:in `each'
1: from /usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.0.2/lib/bundler/runtime.rb:31:in `block in setup'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.0.2/lib/bundler/runtime.rb:319:in `check_for_activated_spec!': You have already activated bundler 1.17.2, but your Gemfile requires bundler 2.0.2. Since bundler is a default gem, you can either remove your dependency on it or try updating to a newer version of bundler that supports bundler as a default gem. (Gem::LoadError)
Note: It was working before with Rails 5 and Nginx Unicorn Server.
Fix
Use root / su account
Delete Gemfile.lock
install rails and bundler gems
$ bundle install --binstubs
gem 'sprockets', '~>3.0'in Gemfile
bundle update sprockets
$ RAILS_ENV=production bundle exec rails console
Note: * Commit the new / modified files.

Rails: bundler/runtime.rb:in `block in setup': You have already activated activesupport

After bundle update (Deploy app), i had this problem at bottom,
I'm use rbenv and CentOS on Deploy Server.
And I have other project running whiteout problems.
I'm tried to run "bundle exec" and "bundle exec rails s" and "bundle exec puma" but the problem stay.
Update 1: "bundle install --binstubs" running fine but not solved the problem.
Update 2: "In your deployed env, delete Gemfile.lock file and do bundle install that would fix your install" not worked.
Uptade 3: Child problem: Rails: rubygems/dependency.rb:318:in `to_specs': Could not find 'activesupport'
Update 4: "You can try to update the version of activesupport that your application is using to resolve this." not worked.
Update 5: After rollback the project to old git hash the problem not occurred, but at last commit the problem still.
Looks like your app's ./bin/rails is a stub that was generated by Bundler.
In Rails 4, your app's bin/ directory contains executables that are versioned
like any other source code, rather than stubs that are generated on demand.
Here's how to upgrade:
bundle config --delete bin # Turn off Bundler's stub generator
rake rails:update:bin # Use the new Rails 4 executables
git add bin # Add bin/ to source control
You may need to remove bin/ from your .gitignore as well.
When you install a gem whose executable you want to use in your app,
generate it and add it to source control:
bundle binstubs some-gem-name
git add bin/new-executable
WARN: Unresolved specs during Gem::Specification.reset:
json (>= 1.7.7, ~> 1.7)
minitest (~> 5.1)
rack (>= 1.0, ~> 1.6)
loofah (~> 2.0)
rails-dom-testing (>= 1.0.5, ~> 1.0)
thor (< 2.0, >= 0.18.1)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
/home/rails/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:34:in `block in setup': You have already activated activesupport 4.2.1, but your Gemfile requires activesupport 4.2.0. Prepending `bundle exec` to your command may solve this. (Gem::LoadError)
from /home/rails/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:19:in `setup'
from /home/rails/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler.rb:92:in `setup'
from /home/rails/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/setup.rb:8:in `<top (required)>'
from /home/rails/.rbenv/versions/2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:126:in `require'
from /home/rails/.rbenv/versions/2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:126:in `rescue in require'
from /home/rails/.rbenv/versions/2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:39:in `require'
from /var/www/html/zadmin/config/boot.rb:3:in `<top (required)>'
from /home/rails/.rbenv/versions/2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:119:in `require'
from /home/rails/.rbenv/versions/2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:119:in `require'
from /home/rails/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/app_rails_loader.rb:44:in `block in exec_app_rails'
from /home/rails/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/app_rails_loader.rb:34:in `loop'
from /home/rails/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/app_rails_loader.rb:34:in `exec_app_rails'
from /home/rails/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/cli.rb:5:in `<top (required)>'
from /home/rails/.rbenv/versions/2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:67:in `require'
from /home/rails/.rbenv/versions/2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:67:in `require'
from /home/rails/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/railties-4.2.1/bin/rails:9:in `<top (required)>'
from /home/rails/.rbenv/versions/2.2.1/bin/rails:23:in `load'
from /home/rails/.rbenv/versions/2.2.1/bin/rails:23:in `<main>'
Thanks!
You can try to update the version of activesupport that your application is using to resolve this.
It sounds like your system has activesupport v4.2.1 while your Gemfile.lock specifies v4.2.0. To update the version of activesupport that your Gemfile.lock is specifying, try running the following:
bundle update activesupport
Additionally, you can try to delete your system activesupport gem via gem uninstall activesupport and then reinstall it via bundle install.

github-pages won't run locally

When I try and run github-pages (bundle exec jekyll build) it fails with:
bundle exec jekyll build
/usr/local/rvm/gems/ruby-2.2.4/gems/commander-4.1.5/lib/commander/runner.rb:365:in `block in require_program': program version required (Commander::Runner::CommandError)
from /usr/local/rvm/gems/ruby-2.2.4/gems/commander-4.1.5/lib/commander/runner.rb:364:in `each'
from /usr/local/rvm/gems/ruby-2.2.4/gems/commander-4.1.5/lib/commander/runner.rb:364:in `require_program'
from /usr/local/rvm/gems/ruby-2.2.4/gems/commander-4.1.5/lib/commander/runner.rb:52:in `run!'
from /usr/local/rvm/gems/ruby-2.2.4/gems/commander-4.1.5/lib/commander/delegates.rb:7:in `run!'
from /usr/local/rvm/gems/ruby-2.2.4/gems/commander-4.1.5/lib/commander/import.rb:10:in `block in <top (required)>'
/usr/local/rvm/gems/ruby-2.2.4/gems/safe_yaml-1.0.3/lib/safe_yaml/load.rb:43:in `<module:SafeYAML>': undefined method `tagged_classes' for Psych:Module (NoMethodError)
from /usr/local/rvm/gems/ruby-2.2.4/gems/safe_yaml-1.0.3/lib/safe_yaml/load.rb:26:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.2.4/gems/safe_yaml-1.0.3/lib/safe_yaml.rb:1:in `require'
from /usr/local/rvm/gems/ruby-2.2.4/gems/safe_yaml-1.0.3/lib/safe_yaml.rb:1:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.2.4/gems/jekyll-1.5.1/lib/jekyll.rb:21:in `require'
from /usr/local/rvm/gems/ruby-2.2.4/gems/jekyll-1.5.1/lib/jekyll.rb:21:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.2.4/gems/jekyll-1.5.1/bin/jekyll:7:in `require'
from /usr/local/rvm/gems/ruby-2.2.4/gems/jekyll-1.5.1/bin/jekyll:7:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.2.4/bin/jekyll:23:in `load'
from /usr/local/rvm/gems/ruby-2.2.4/bin/jekyll:23:in `<main>'
from /usr/local/rvm/gems/ruby-2.2.4/bin/ruby_executable_hooks:15:in `eval'
from /usr/local/rvm/gems/ruby-2.2.4/bin/ruby_executable_hooks:15:in `<main>'
The Gemfile is:
source 'https://rubygems.org'
gem 'github-pages'
gem 'guard-jekyll-plus'
Any idea what might be going wrong? I've installed (bundle install) many times on my Mac. This is on Ubuntu.
Thanks in advance,
Ian
Ok, I figured this out with thanks to Virtua Creative, and this post: https://github.com/sstephenson/execjs/issues/154
I needed to uninstall jekyll and github-pages, then reinstall, and after reinstalling I also had to update, so:
gem uninstall jekyll
gem uninstall github-pages
bundle install
bundle update
Then I found that I had no javascript environment, so I had to modify my Gemfile:
source 'https://rubygems.org'
gem 'github-pages'
gem 'therubyracer'
And install again
bundle install
Now it's all good.
Ian

Asset precompilation fails after rails upgrade

I just upgraded from Rails 4.0.4 to 4.1.8, and when I push to our staging server on Heroku, I get the following error
Removing jquery-rails (3.0.4)
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
rake aborted!
NoMethodError: undefined method `[]=' for nil:NilClass
/tmp/build_6e5605f8ccbbe1dcb495bb63b761220d/config/initializers/puma_database_connection.rb:7:in `block (2 levels) in <top (required)>'
/tmp/build_6e5605f8ccbbe1dcb495bb63b761220d/vendor/bundle/ruby/2.0.0/gems/activesupport-4.1.8/lib/active_support/lazy_load_hooks.rb:38:in `instance_eval'
/tmp/build_6e5605f8ccbbe1dcb495bb63b761220d/vendor/bundle/ruby/2.0.0/gems/activesupport
/tmp/build_6e5605f8ccbbe1dcb495bb63b761220d/vendor/bundle/ruby/2.0.0/gems/railties-
Tasks: TOP => environment
(See full trace by running task with --trace)
!
! Precompiling assets failed.
When I run assets:precompile RAILS_ENV=development, it works fine
Any advice?

Rails Server Could not find a JavaScript runtime

i am getting the following error. tried to search and try to install extjs, bundler etc gems still am getting the error
harsha#harshamv:~/www/simple_cms$ rails s
/home/harsha/.rvm/gems/ruby-2.0.0-p247/gems/execjs-2.0.2/lib/execjs/runtimes.rb:51:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
from /home/harsha/.rvm/gems/ruby-2.0.0-p247/gems/execjs-2.0.2/lib/execjs.rb:5:in `<module:ExecJS>'
from /home/harsha/.rvm/gems/ruby-2.0.0-p247/gems/execjs-2.0.2/lib/execjs.rb:4:in `<top (required)>'
from /home/harsha/.rvm/gems/ruby-2.0.0-p247/gems/uglifier-2.3.1/lib/uglifier.rb:3:in `require'
from /home/harsha/.rvm/gems/ruby-2.0.0-p247/gems/uglifier-2.3.1/lib/uglifier.rb:3:in `<top (required)>'
from /home/harsha/.rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
from /home/harsha/.rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
from /home/harsha/.rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
from /home/harsha/.rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
from /home/harsha/.rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
from /home/harsha/.rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
from /home/harsha/.rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
from /home/harsha/www/simple_cms/config/application.rb:7:in `<top (required)>'
from /home/harsha/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.1/lib/rails/commands.rb:74:in `require'
from /home/harsha/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.1/lib/rails/commands.rb:74:in `block in <top (required)>'
from /home/harsha/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.1/lib/rails/commands.rb:71:in `tap'
from /home/harsha/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.1/lib/rails/commands.rb:71:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
try to install latest nodejs.
more details can be found here ExecJS and could not find a JavaScript runtime
Ubuntu Users
I'm on Ubuntu 11.04 and had similar issues. Installing Node.js fixed it.
As of Ubuntu 13.04 x64 you only need to run:
sudo apt-get install nodejs
This will solve the problem.
CentOS/RedHat Users
sudo yum install nodejs
ALTERNATE SOLUTION
Just add ExecJS and the Ruby Racer in your gem file and run bundle install after.
gem 'execjs'
gem 'therubyracer'