github-pages won't run locally - github-pages

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

Related

Error Installing Spree in a Rails Project

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

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.

Activeadmin gem error on heroku deploy during assets:precompile

I had my application running on local. During deployment, I got several issues:
First, I wrapped relational objects in order to deploy, otherwise deploy gave no "tags" table error
if ActiveRecord::Base.connection.table_exists? 'tags'
filter :tags_keyword, :as => :check_boxes, :collection => Tag.all.collect {|o| [o.keyword, o.keyword]}
end
Then I run migrations and seeded the database. But this time, I had no assets working which made me realize heroku is not compiling assets during deployment.
I updated .gitignore to oversight manifest files so heroku would compile assets beforehand. But that operation gave me the following error;
remote: -----> Preparing app for Rails asset pipeline
remote: Running: rake assets:precompile
remote: rake aborted!
remote: NoMethodError: undefined method `<<' for true:TrueClass
remote: /tmp/build_392c42fc00109fc0ac97d8dd67521707/vendor/bundle/ruby/2.2.0/gems/activeadmin-1.0.0.pre1/lib/active_admin/engine.rb:5:in `block (2 levels) in <class:Engine>'
remote: /tmp/build_392c42fc00109fc0ac97d8dd67521707/vendor/bundle/ruby/2.2.0/gems/activeadmin-1.0.0.pre1/lib/active_admin/engine.rb:4:in `each'
remote: /tmp/build_392c42fc00109fc0ac97d8dd67521707/vendor/bundle/ruby/2.2.0/gems/activeadmin-1.0.0.pre1/lib/active_admin/engine.rb:4:in `block in <class:Engine>'
remote: /tmp/build_392c42fc00109fc0ac97d8dd67521707/vendor/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/initializable.rb:30:in `instance_exec'
remote: /tmp/build_392c42fc00109fc0ac97d8dd67521707/vendor/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/initializable.rb:30:in `run'
remote: /tmp/build_392c42fc00109fc0ac97d8dd67521707/vendor/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/initializable.rb:55:in `block in run_initializers'
remote: /tmp/build_392c42fc00109fc0ac97d8dd67521707/vendor/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/initializable.rb:54:in `run_initializers'
remote: /tmp/build_392c42fc00109fc0ac97d8dd67521707/vendor/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/application.rb:352:in `initialize!'
remote: /tmp/build_392c42fc00109fc0ac97d8dd67521707/config/environment.rb:5:in `<top (required)>'
remote: /tmp/build_392c42fc00109fc0ac97d8dd67521707/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `require'
remote: /tmp/build_392c42fc00109fc0ac97d8dd67521707/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `block in require'
remote: /tmp/build_392c42fc00109fc0ac97d8dd67521707/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:240:in `load_dependency'
remote: /tmp/build_392c42fc00109fc0ac97d8dd67521707/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `require'
remote: /tmp/build_392c42fc00109fc0ac97d8dd67521707/vendor/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/application.rb:328:in `require_environment!
remote: /tmp/build_392c42fc00109fc0ac97d8dd67521707/vendor/bundle/ruby/2.2.0/gems/railties-4.2.1/lib/rails/application.rb:457:in `block in run_tasks_blocks'
remote: /tmp/build_392c42fc00109fc0ac97d8dd67521707/vendor/bundle/ruby/2.2.0/gems/sprockets-rails-2.3.2/lib/sprockets/rails/task.rb:64:in `block (2 levels) in define'
remote: Tasks: TOP => environment
remote: (See full trace by running task with --trace)
remote: !
remote: ! Precompiling assets failed.
remote: !
remote:
remote: ! Push rejected, failed to compile Ruby app
This is the engine.rb file that error logs which is under the AA gem folder
module ActiveAdmin
class Engine < ::Rails::Engine
initializer "active_admin.precompile", group: :all do |app|
ActiveAdmin.application.stylesheets.each do |path, _|
app.config.assets.precompile << path
end
ActiveAdmin.application.javascripts.each do |path|
app.config.assets.precompile << path
end
end
initializer 'active_admin.routes' do
require 'active_admin/helpers/routes/url_helpers'
end
end
end
I run on ubuntu 15.04, with ruby -v '2.2.2p95', rails -v '4.2.1' and kind of stuck about what to do
I found the issue is my not using rails_12_factor gem and playing too much with depreciated rails environment variables. After several trials I managed to roll-back to default settings and it worked!

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'