Precompiling assets with Capistrano shows error on load 'deploy/assets' - ruby-on-rails-3.1

I'm using rails 3.1.0 and trying to setup Capistrano to precompile assets. Capistrano v2.8.0 has "load 'deploy/assets'" in Capfile. But when I run "cap deploy" it shows the following error:
cap deploy
/usr/lib/ruby/1.8/capistrano/configuration/loading.rb:183:in `find_file_in_load_path': no such file to load -- deploy/assets (LoadError)
from /usr/lib/ruby/1.8/capistrano/configuration/loading.rb:171:in `load_from_file'
from /usr/lib/ruby/1.8/capistrano/configuration/loading.rb:89:in `load'
from /usr/lib/ruby/1.8/capistrano/configuration/loading.rb:86:in `load'
from /usr/lib/ruby/1.8/capistrano/configuration/loading.rb:86:in `each'
from /usr/lib/ruby/1.8/capistrano/configuration/loading.rb:86:in `load'
from Capfile:3:in `load'
from /usr/lib/ruby/1.8/capistrano/configuration/loading.rb:172:in `load_from_file'
from /usr/lib/ruby/1.8/capistrano/configuration/loading.rb:89:in `load'
from /usr/lib/ruby/1.8/capistrano/configuration/loading.rb:86:in `load'
from /usr/lib/ruby/1.8/capistrano/configuration/loading.rb:86:in `each'
from /usr/lib/ruby/1.8/capistrano/configuration/loading.rb:86:in `load'
from /usr/lib/ruby/1.8/capistrano/cli/execute.rb:64:in `load_recipes'
from /usr/lib/ruby/1.8/capistrano/cli/execute.rb:64:in `each'
from /usr/lib/ruby/1.8/capistrano/cli/execute.rb:64:in `load_recipes'
from /usr/lib/ruby/1.8/capistrano/cli/execute.rb:30:in `execute!'
from /usr/lib/ruby/1.8/capistrano/cli/execute.rb:14:in `execute'
from /usr/bin/cap:4
UPDATE
It magically started working after I restarted my PC (Ubuntu).

Can you please demonstrate that the cap that you are using is indeed in the bundle?
Please share your Gemfile and your Capfile, chances are that "cap" isn't in the bundle, so it's loading a previous version, be sure to run with "bundle exec" (to make sure to use the correct capistrano)

As I encountered the same problem currently, I noticed that using RVM with a project specific .rvmrc was not reloaded after I switched branches with git checkout. The result was that the system wide capistrano version 2.6.0 was being used instead of the project specific capistrano version 2.9.0. This lead to the same error message 'no such file to load -- deploy/assets (LoadError)'.
A simple cd out of the project path and again into the project path solved the problem for me.

What worked for me for this issue was installing the latest version of capistrano (gem install capistrano).

Related

capistrano suddenly stopped working

i'm using a ubuntu vagrant box with installed capistrano to develop an application.
when i tried to deploy i get the following error:
/usr/lib/ruby/vendor_ruby/capistrano/configuration/loading.rb:152:in `require': no such file to load -- capistrano/ext/multistage (LoadError)
from /usr/lib/ruby/vendor_ruby/capistrano/configuration/loading.rb:152:in `require'
from ./config/deploy.rb:3:in `load'
from /usr/lib/ruby/vendor_ruby/capistrano/configuration/loading.rb:172:in `load_from_file'
from /usr/lib/ruby/vendor_ruby/capistrano/configuration/loading.rb:89:in `load'
from /usr/lib/ruby/vendor_ruby/capistrano/configuration/loading.rb:86:in `load'
from /usr/lib/ruby/vendor_ruby/capistrano/configuration/loading.rb:86:in `each'
from /usr/lib/ruby/vendor_ruby/capistrano/configuration/loading.rb:86:in `load'
from Capfile:4:in `load'
from /usr/lib/ruby/vendor_ruby/capistrano/configuration/loading.rb:172:in `load_from_file'
from /usr/lib/ruby/vendor_ruby/capistrano/configuration/loading.rb:89:in `load'
from /usr/lib/ruby/vendor_ruby/capistrano/configuration/loading.rb:86:in `load'
from /usr/lib/ruby/vendor_ruby/capistrano/configuration/loading.rb:86:in `each'
from /usr/lib/ruby/vendor_ruby/capistrano/configuration/loading.rb:86:in `load'
from /usr/lib/ruby/vendor_ruby/capistrano/cli/execute.rb:65:in `load_recipes'
from /usr/lib/ruby/vendor_ruby/capistrano/cli/execute.rb:65:in `each'
from /usr/lib/ruby/vendor_ruby/capistrano/cli/execute.rb:65:in `load_recipes'
from /usr/lib/ruby/vendor_ruby/capistrano/cli/execute.rb:31:in `execute!'
from /usr/lib/ruby/vendor_ruby/capistrano/cli/execute.rb:14:in `execute'
from /usr/bin/cap:4
as google suggested i tried to reinstall capistrano, but this failed because of dependencies(net-ssh requires ruby >= 2.0)
so i installed net-ssh v2.9.2
sudo gem install net-ssh -v 2.9.2
Fetching: net-ssh-2.9.2.gem (100%)
Successfully installed net-ssh-2.9.2
1 gem installed
but now the next dependency error occures...
How do i make a fresh installation of capistrano working?
do i need a newer version of ruby(apt-get install ruby tells me that the newest version is already installed)?
Or is the cause of this error something complete different?
I can't see anything in your trace about what version of ruby you're on, but you did say "net-ssh requires ruby >= 2.0", so you might need a newer version of ruby like you said. You can check the version of ruby you're using with ruby -v. I would also recommend using a version manager so that you can use multiple versions between projects. I find RVM or rbenv to be good starting points.
OK, this is strange...
after running vagrant provision multiple(~5) times and installing/deinstalling multiple gems and ruby versions the next "vagrant provision" fixed the problem magicaly. i still dont know why this error occured and what fixed it, bull i'll close this question...

Install Knowledgebase plugin on Bitnami Redmine 3.1.1

I'm trying to install Knowledgebase plugin on Bitnami Redmine 3.1.1 (running on Windows Server 2012R2). I tried as follows but no luck.
Downloaded redmine-3.0-compat
and copied it to htdocs\plugins and renamed the extracted folder as "redmine_knowledgebase".
Downloaded acts-as-taggable-on and redmine_acts_as_taggable_on from Github and put them in htdocs\lib\plugins
Opened "Bitnami Redmine Stack Environment" window and execute "bundle install --no-deployment"
Executed "rake redmine:plugins RAILS_ENV=production"
Then I got the following error and the plugin does not work.
rake aborted!
LoadError: cannot load such file -- generators/acts_as_taggable_on/migration/
plates/active_record/migration
C:/Bitnami/redmine-3.1.1-0/apps/redmine/htdocs/lib/plugins/redmine_acts_as_ta
ble_on/lib/redmine_acts_as_taggable_on/migration.rb:1:in <top (required)>'
C:/Bitnami/redmine-3.1.1-0/apps/redmine/htdocs/lib/plugins/redmine_acts_as_ta
ble_on/lib/redmine_acts_as_taggable_on/initialize.rb:3:in'
C:/Bitnami/redmine-3.1.1-0/apps/redmine/htdocs/plugins/redmine_knowledgebase/
t.rb:2:in <top (required)>'
C:/Bitnami/redmine-3.1.1-0/apps/redmine/htdocs/lib/redmine/plugin.rb:155:in
ck in load'
C:/Bitnami/redmine-3.1.1-0/apps/redmine/htdocs/lib/redmine/plugin.rb:146:in
h'
C:/Bitnami/redmine-3.1.1-0/apps/redmine/htdocs/lib/redmine/plugin.rb:146:in
d'
C:/Bitnami/redmine-3.1.1-0/apps/redmine/htdocs/config/initializers/30-redmine
:21:in <top (required)>'
C:/Bitnami/redmine-3.1.1-0/apps/redmine/htdocs/config/environment.rb:14:in<
(required)>'
C:/Bitnami/redmine-3.1.1-0/apps/redmine/htdocs/lib/tasks/redmine.rake:52:in `
ck (2 levels) in '
Tasks: TOP => redmine:plugins:migrate => environment
(See full trace by running task with --trace)
Does anyone know how to fix this?
Thanks in advance.
Bitnami developer here.
It seems that the plugin is not compatible with your Redmine version. It is only compatible with Redmine 2.5.x, 2.4.x, 2.3.x, 2.2.x.
You can check it here:
https://www.redmine.org/plugins/redmine_knowledgebase
I hope it helps.
A quick workaround is to just delete db/migrate/20130513154700_add_tags_and_taggings.rb from the knowledgebase, then run the migrations.

Github-Pages error running Jekyll Locally

I am trying to run my Github-pages website locally. I have it running on another machine that is using Ruby 2.1.0 on Windows x64. Today I wanted to run locally on my home machine that is running Ruby 2.2.0. I pulled my repo locally, ran bundle install after a few issues with nokogiri I was able to get through a clean bundle install. I then proceeded to run the command bundle exec jekyll serve -w. Upon running this command I receive the following errors:
/Users/<me>/.rvm/gems/ruby-2.2.0#global/gems/commander 4.1.6/lib/commander/runner.rb:385:in block in require_program': program version required (Commander::Runner::CommandError)
from /Users/<me>/.rvm/gems/ruby-2.2.0#global/gems/commander-4.1.6/lib/commander/runner.rb:384:in `each'
from /Users/<me>/.rvm/gems/ruby-2.2.0#global/gems/commander-4.1.6/lib/commander/runner.rb:384:in require_program'
from /Users/<me>/.rvm/gems/ruby-2.2.0#global/gems/commander-4.1.6/lib/commander/runner.rb:52:in run!'
from /Users/<me>/.rvm/gems/ruby-2.2.0#global/gems/commander-4.1.6/lib/commander/delegates.rb:8:in run!'
from /Users/<me>/.rvm/gems/ruby-2.2.0#global/gems/commander-4.1.6/lib/commander/import.rb:10:in block in <top (required)>'
/Users/<me>/.rvm/gems/ruby-2.2.0/gems/safe_yaml-1.0.3/lib/safe_yaml/load.rb:43:in <module:SafeYAML>': undefined method tagged_classes' for Psych:Module (NoMethodError)
from /Users/<me>/.rvm/gems/ruby-2.2.0/gems/safe_yaml-1.0.3/lib/safe_yaml/load.rb:26:in <top (required)>'
from /Users/<me>/.rvm/gems/ruby-2.2.0/gems/safe_yaml-1.0.3/lib/safe_yaml.rb:1:in require'
from /Users/<me>/.rvm/gems/ruby-2.2.0/gems/safe_yaml-1.0.3/lib/safe_yaml.rb:1:in <top (required)>'
from /Users/<me>/.rvm/gems/ruby-2.2.0/gems/jekyll-1.5.1/lib/jekyll.rb:21:in require'
from /Users/<me>/.rvm/gems/ruby-2.2.0/gems/jekyll-1.5.1/lib/jekyll.rb:21:in <top (required)>'
from /Users/<me>/.rvm/gems/ruby-2.2.0/gems/jekyll-1.5.1/bin/jekyll:7:in require'
from /Users/<me>/.rvm/gems/ruby-2.2.0/gems/jekyll-1.5.1/bin/jekyll:7:in <top (required)>'
from /Users/<me>/.rvm/gems/ruby-2.2.0/bin/jekyll:23:in load'
from /Users/<me>/.rvm/gems/ruby-2.2.0/bin/jekyll:23:in <main>'
from /Users/<me>/.rvm/gems/ruby-2.2.0/bin/ruby_executable_hooks:15:in eval'
from /Users/<me>/.rvm/gems/ruby-2.2.0/bin/ruby_executable_hooks:15:in <main>'
I'm beginning to believe that this issue is not to do with my setup but with an incompatibility with jekyll on ruby 2.2.0. Any help would be appreciated.
Thank you!
So after some more digging I was missing a simple step. After running the command bundle install I needed to run bundle update. Once I did this the version of jekyll and other dependencies was brought up to the correct version and I was then able to run my bundle exec jekyll serve -w command without any errors.
This seems strange that the initial install command would not install the latest version.

NameError Rack::Attack installing GitLab 7.2

I've got a NameError installing GitLab 7.2. More precisely when initializing the database:
$ bundle exec rake gitlab:setup RAILS_ENV=production --trace
rake aborted!
NameError: uninitialized constant Rack::Attack
/home/[user]/gitlab/config/application.rb:67:in `<class:Application>'
/home/[user]/gitlab/config/application.rb:9:in `<module:Gitlab>'
/home/[user]/gitlab/config/application.rb:8:in `<top (required)>'
/home/[user]/gitlab/Rakefile:5:in `require'
/home/[user]/gitlab/Rakefile:5:in `<top (required)>'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/rake_module.rb:28:in `load'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/rake_module.rb:28:in `load_rakefile'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:687:in `raw_load_rakefile'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:94:in `block in load_rakefile'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:176:in `standard_exception_handling'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:93:in `load_rakefile'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:77:in `block in run'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:176:in `standard_exception_handling'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:75:in `run'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.3.2/bin/rake:33:in `<top (required)>'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/bin/rake:23:in `load'
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/bin/rake:23:in `<main>'
Yes, I found this answer discussing the error with an older version of GitLab, where the following line in config/application.rb had to be uncommented
config.middleware.use Rack::Attack
In 7.2. this line is uncommented from the start. It's there. It's apparently where rake chokes.
I renamed config/initializers/rack_attack.rb.example to config/initializers/rack_attack.rb as well.
Installing the bundle gems worked like a charm.
bundle install --deployment --without development test postgres aws
rack-attack is in the bundle's gems folder:
/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rack-attack-2.3.0/lib/rack/attack.rb
Does anyone know what could be causing this problem? Thanks a lot!
Very ugly workaround™
I added the following line to config/application.rb and it's working:
require '/home/[user]/gitlab/vendor/bundle/ruby/1.9.1/gems/rack-attack-2.3.0/lib/rack/attack.rb'
Why is this working? What's wrong? Thanks!
I can't add comment, so I need to post it as an answer: You need to update your ruby & gems: take a look at https://github.com/gitlabhq/gitlabhq/blob/master/doc/install/installation.md#2-ruby.
GitLab requires Ruby (MRI) 2.0 or 2.1 You will have to use the
standard MRI implementation of Ruby. We love JRuby and Rubinius) but
GitLab needs several Gems that have native extensions.

nanoc installation setup in Linux

I'm a newbie to Ruby. Trying to setup nanoc in my machine. I'm running Ubuntu 14.04.
After the nanoc installation, when I type
$nanoc --version
I get the following errors:
/home/ananth/.rvm/gems/ruby-head#global/gems/bundler-1.6.2/lib/bundler/shared_helpers.rb:24:in `default_gemfile': Could not locate Gemfile (Bundler::GemfileNotFound)
from /home/ananth/.rvm/gems/ruby-head#global/gems/bundler-1.6.2/lib/bundler.rb:248:in `default_gemfile'
from /home/ananth/.rvm/gems/ruby-head#global/gems/bundler-1.6.2/lib/bundler.rb:192:in `root'
from /home/ananth/.rvm/gems/ruby-head#global/gems/bundler-1.6.2/lib/bundler.rb:99:in `bundle_path'
from /home/ananth/.rvm/gems/ruby-head#global/gems/bundler-1.6.2/lib/bundler.rb:400:in `configure_gem_home_and_path'
from /home/ananth/.rvm/gems/ruby-head#global/gems/bundler-1.6.2/lib/bundler.rb:90:in `configure'
from /home/ananth/.rvm/gems/ruby-head#global/gems/bundler-1.6.2/lib/bundler.rb:151:in `definition'
from /home/ananth/.rvm/gems/ruby-head#global/gems/bundler-1.6.2/lib/bundler.rb:116:in `setup'
from /home/ananth/.rvm/gems/ruby-head#global/gems/bundler-1.6.2/lib/bundler.rb:132:in `require'
from /home/ananth/.rvm/gems/ruby-head/gems/nanoc-3.7.0/bin/nanoc:7:in `<top (required)>'
from /home/ananth/.rvm/gems/ruby-head/bin/nanoc:23:in `load'
from /home/ananth/.rvm/gems/ruby-head/bin/nanoc:23:in `<main>'
from /home/ananth/.rvm/gems/ruby-head/bin/ruby_executable_hooks:15:in `eval'
from /home/ananth/.rvm/gems/ruby-head/bin/ruby_executable_hooks:15:in `<main>'
Am I missing something from my rvm? Anything to do with $PATH, .bashrc or .bash_profile?
Thanks for the help in advance!
This is a bug in 3.7.0 that will be fixed in 3.7.1.
3.7.0 unintentionally requires a Gemfile to be present when Bundler is installed.
To avoid this bug, either temporarily switch back to 3.6.11, or use a Gemfile (I recommend the latter).

Resources