uninitialized constant Capistrano (NameError) - rvm

rvm 1.14.5, rvm-capistrano (1.2.2) and capistrano (2.12.0)
My Gemfile is :
group :development, :test do
gem 'rvm-capistrano'
gem 'capistrano'
end
When I try to start passenger, I keep seeing this error :
[ pid=4691 thr=76294140 file=utils.rb:176 time=2012-07-04 11:37:06.179 ]: *** Exception NameError in PhusionPassenger::Rack::ApplicationSpawner (uninitialized constant Capistrano) (process 4691, thread #<Thread:0x9184ff8>):
from /home/ved/.rvm/gems/ruby-1.9.3-p194/gems/rvm-capistrano-1.2.2/lib/rvm/capistrano.rb:3:in `<top (required)>'
from /home/ved/.rvm/gems/ruby-1.9.3-p194#global/gems/bundler-1.1.3/lib/bundler/runtime.rb:74:in `require'
from /home/ved/.rvm/gems/ruby-1.9.3-p194#global/gems/bundler-1.1.3/lib/bundler/runtime.rb:74:in `rescue in block in require'
from /home/ved/.rvm/gems/ruby-1.9.3-p194#global/gems/bundler-1.1.3/lib/bundler/runtime.rb:62:in `block in require'
from /home/ved/.rvm/gems/ruby-1.9.3-p194#global/gems/bundler-1.1.3/lib/bundler/runtime.rb:55:in `each'
from /home/ved/.rvm/gems/ruby-1.9.3-p194#global/gems/bundler-1.1.3/lib/bundler/runtime.rb:55:in `require'
from /home/ved/.rvm/gems/ruby-1.9.3-p194#global/gems/bundler-1.1.3/lib/bundler.rb:119:in `require'
from /home/ved/rails_projects/grabber/config/application.rb:12:in `<top (required)>'
from /home/ved/rails_projects/grabber/config/environment.rb:3:in `require'
from /home/ved/rails_projects/grabber/config/environment.rb:3:in `<top (required)>'
from config.ru:3:in `require'
from config.ru:3:in `block in <main>'

Just taking a stab here, but make sure that you are excluding the development and test group when your bundle is installed.
bundle install --without test development
It sounds like for some reason your application is trying to load rvm-capistrano.

Related

LoadError: cannot load such file -- test/unit/error

I am trying to install insoshi in Rails 3.2.21 with ruby 1.9.3 every thing gone good but now I am stopped with an error when I try $rake gems:install it gives an error
rake aborted!
LoadError: cannot load such file -- test/unit/error
C:/Sites/insoshi/vendor/rails/activesupport/lib/active_support/dependencies.rb:1
53:in `block in require'
C:/Sites/insoshi/vendor/rails/activesupport/lib/active_support/dependencies.rb:5
21:in `new_constants_in'
C:/Sites/insoshi/vendor/rails/activesupport/lib/active_support/dependencies.rb:1
53:in `require'
C:/Sites/insoshi/vendor/rails/activesupport/lib/active_support/deprecation.rb:22
4:in `<top (required)>'
C:/Sites/insoshi/vendor/rails/activesupport/lib/active_support/dependencies.rb:1
53:in `block in require'
C:/Sites/insoshi/vendor/rails/activesupport/lib/active_support/dependencies.rb:5
21:in `new_constants_in'
C:/Sites/insoshi/vendor/rails/activesupport/lib/active_support/dependencies.rb:1
53:in `require'
C:/Sites/insoshi/vendor/rails/activesupport/lib/active_support.rb:37:in `<top (r
equired)>'
C:/Sites/insoshi/vendor/rails/railties/lib/tasks/misc.rake:11:in `<top (required
)>'
C:/Sites/insoshi/vendor/rails/railties/lib/tasks/rails.rb:4:in `load'
C:/Sites/insoshi/vendor/rails/railties/lib/tasks/rails.rb:4:in `block in <top (r
equired)>'
C:/Sites/insoshi/vendor/rails/railties/lib/tasks/rails.rb:4:in `each'
C:/Sites/insoshi/vendor/rails/railties/lib/tasks/rails.rb:4:in `<top (required)>
'
C:/Sites/insoshi/Rakefile:10:in `<top (required)>'
(See full trace by running task with --trace)
I am totally new with rails. hope for help
Try adding following gem into your gem file
gem 'test-unit'
Hope it will solve your problem.

Please require this file from within a Capistrano recipe (LoadError)

I'm using Capistrano 2 with Rails 3 project. Recently I rebuilt my gemset form scratch and now I receive error "Please require this file from within a Capistrano recipe (LoadError)" when I try to run rails server.
Detailed error message:
/Users/leonidlukin/.rvm/rubies/ruby-1.9.3-p429/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /Users/leonidlukin/Sites/moscowshows/script/rails server -b 0.0.0.0 -p 3000 -e development
/Users/leonidlukin/.rvm/gems/ruby-1.9.3-p429#moscowshows/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:18:in `instance': Please require this file from within a Capistrano recipe (LoadError)
from /Users/leonidlukin/.rvm/gems/ruby-1.9.3-p429#moscowshows/gems/rvm-capistrano-1.5.6/lib/rvm/capistrano/helpers/base.rb:16:in `rvm_with_capistrano'
from /Users/leonidlukin/.rvm/gems/ruby-1.9.3-p429#moscowshows/gems/rvm-capistrano-1.5.6/lib/rvm/capistrano/helpers/_cset.rb:3:in `<top (required)>'
from /Users/leonidlukin/.rvm/gems/ruby-1.9.3-p429#moscowshows/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
from /Users/leonidlukin/.rvm/gems/ruby-1.9.3-p429#moscowshows/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `block in require'
from /Users/leonidlukin/.rvm/gems/ruby-1.9.3-p429#moscowshows/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency'
from /Users/leonidlukin/.rvm/gems/ruby-1.9.3-p429#moscowshows/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
from /Users/leonidlukin/.rvm/gems/ruby-1.9.3-p429#moscowshows/gems/rvm-capistrano-1.5.6/lib/rvm/capistrano/base.rb:1:in `<top (required)>'
from /Users/leonidlukin/.rvm/gems/ruby-1.9.3-p429#moscowshows/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
from /Users/leonidlukin/.rvm/gems/ruby-1.9.3-p429#moscowshows/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `block in require'
from /Users/leonidlukin/.rvm/gems/ruby-1.9.3-p429#moscowshows/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency'
from /Users/leonidlukin/.rvm/gems/ruby-1.9.3-p429#moscowshows/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
from /Users/leonidlukin/.rvm/gems/ruby-1.9.3-p429#moscowshows/gems/rvm-capistrano-1.5.6/lib/rvm/capistrano/selector.rb:1:in `<top (required)>'
from /Users/leonidlukin/.rvm/gems/ruby-1.9.3-p429#moscowshows/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
from /Users/leonidlukin/.rvm/gems/ruby-1.9.3-p429#moscowshows/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `block in require'
from /Users/leonidlukin/.rvm/gems/ruby-1.9.3-p429#moscowshows/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency'
from /Users/leonidlukin/.rvm/gems/ruby-1.9.3-p429#moscowshows/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
from /Users/leonidlukin/.rvm/gems/ruby-1.9.3-p429#moscowshows/gems/rvm-capistrano-1.5.6/lib/rvm/capistrano.rb:3:in `<top (required)>'
from /Users/leonidlukin/.rvm/gems/ruby-1.9.3-p429#moscowshows/gems/bundler-1.8.0/lib/bundler/runtime.rb:85:in `require'
from /Users/leonidlukin/.rvm/gems/ruby-1.9.3-p429#moscowshows/gems/bundler-1.8.0/lib/bundler/runtime.rb:85:in `rescue in block in require'
from /Users/leonidlukin/.rvm/gems/ruby-1.9.3-p429#moscowshows/gems/bundler-1.8.0/lib/bundler/runtime.rb:68:in `block in require'
from /Users/leonidlukin/.rvm/gems/ruby-1.9.3-p429#moscowshows/gems/bundler-1.8.0/lib/bundler/runtime.rb:61:in `each'
from /Users/leonidlukin/.rvm/gems/ruby-1.9.3-p429#moscowshows/gems/bundler-1.8.0/lib/bundler/runtime.rb:61:in `require'
from /Users/leonidlukin/.rvm/gems/ruby-1.9.3-p429#moscowshows/gems/bundler-1.8.0/lib/bundler.rb:134:in `require'
from /Users/leonidlukin/Sites/moscowshows/config/application.rb:13:in `<top (required)>'
from /Users/leonidlukin/.rvm/gems/ruby-1.9.3-p429#moscowshows/gems/railties-3.2.13/lib/rails/commands.rb:53:in `require'
from /Users/leonidlukin/.rvm/gems/ruby-1.9.3-p429#moscowshows/gems/railties-3.2.13/lib/rails/commands.rb:53:in `block in <top (required)>'
from /Users/leonidlukin/.rvm/gems/ruby-1.9.3-p429#moscowshows/gems/railties-3.2.13/lib/rails/commands.rb:50:in `tap'
from /Users/leonidlukin/.rvm/gems/ruby-1.9.3-p429#moscowshows/gems/railties-3.2.13/lib/rails/commands.rb:50:in `<top (required)>'
from /Users/leonidlukin/Sites/moscowshows/script/rails:6:in `require'
from /Users/leonidlukin/Sites/moscowshows/script/rails:6:in `<top (required)>'
from -e:1:in `load'
from -e:1:in `<main>'
Process finished with exit code 1
Which file I should require from within a Capistrano recipe?
The problem is with rvm-capistrano.
Correct it in gemfile. require: false
gem 'rvm-capistrano', require: false
This should help
A better solution I found, instead of removing it, to just move rvm-capistrano before capistrano:
# Deploy with Capistrano
gem 'rvm-capistrano'
gem 'capistrano'
gem 'capistrano-ext'
But, what's strange, I've solved this problem also like that (in my Gemfile, just to comment main capistrano gem):
# Deploy with Capistrano
# gem 'capistrano', :group => :development
gem 'rvm-capistrano', :group => :development
In your Gemfile change this.
gem 'rvm-capistrano', require: false
This will solve the problem without any headache.

Failing to do rails g bootstrap:install with 'twitter-bootstrap-rails'

It seems like I'm having the same issue as the person the OP for:
https://github.com/seyhunak/twitter-bootstrap-rails/issues/27
but I have not been able to fix it.
Doing a basic rails app like described in:
http://railscasts.com/episodes/328-twitter-bootstrap-basics
fails with trying to rails g bootstrap:install.
The base versions of r/r on my system are:
ruby v 1.9.2p320,
rails 3.1.0
on snow leopard 10.6.4
The way I can replicate on my local system:
rails new bsapp --skip-stylesheets
cd bsapp
rails g scaffold product name:string price:decimal --skip-stylesheets
add gem 'twitter-bootstrap-rails' to the assets group in gemfile.
bundle update
rails g bootstrap:install
This is where the problem is.
Hayk-Saakians-Mac:bsapp hayk$ rails g bootstrap:install
/Users/hayk/.rvm/gems/ruby-1.9.2-p320/gems/less-2.2.1/lib/less/java_script/v8_context.rb:61:in `rescue in lock': uninitialized constant V8::JSError (NameError)
from /Users/hayk/.rvm/gems/ruby-1.9.2-p320/gems/less-2.2.1/lib/less/java_script/v8_context.rb:60:in `lock'
from /Users/hayk/.rvm/gems/ruby-1.9.2-p320/gems/less-2.2.1/lib/less/java_script/v8_context.rb:19:in `initialize'
from /Users/hayk/.rvm/gems/ruby-1.9.2-p320/gems/less-2.2.1/lib/less/java_script/v8_context.rb:15:in `new'
from /Users/hayk/.rvm/gems/ruby-1.9.2-p320/gems/less-2.2.1/lib/less/java_script/v8_context.rb:15:in `instance'
from /Users/hayk/.rvm/gems/ruby-1.9.2-p320/gems/less-2.2.1/lib/less/loader.rb:10:in `initialize'
from /Users/hayk/.rvm/gems/ruby-1.9.2-p320/gems/less-2.2.1/lib/less.rb:14:in `new'
from /Users/hayk/.rvm/gems/ruby-1.9.2-p320/gems/less-2.2.1/lib/less.rb:14:in `<module:Less>'
from /Users/hayk/.rvm/gems/ruby-1.9.2-p320/gems/less-2.2.1/lib/less.rb:9:in `<top (required)>'
from /Users/hayk/.rvm/gems/ruby-1.9.2-p320/gems/less-rails-2.2.3/lib/less/rails.rb:6:in `require'
from /Users/hayk/.rvm/gems/ruby-1.9.2-p320/gems/less-rails-2.2.3/lib/less/rails.rb:6:in `<top (required)>'
from /Users/hayk/.rvm/gems/ruby-1.9.2-p320/gems/less-rails-2.2.3/lib/less-rails.rb:1:in `require'
from /Users/hayk/.rvm/gems/ruby-1.9.2-p320/gems/less-rails-2.2.3/lib/less-rails.rb:1:in `<top (required)>'
from /Users/hayk/.rvm/gems/ruby-1.9.2-p320/gems/twitter-bootstrap-rails-2.1.3/lib/twitter-bootstrap-rails.rb:9:in `require'
from /Users/hayk/.rvm/gems/ruby-1.9.2-p320/gems/twitter-bootstrap-rails-2.1.3/lib/twitter-bootstrap-rails.rb:9:in `<top (required)>'
from /Users/hayk/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.2.0/lib/bundler/runtime.rb:68:in `require'
from /Users/hayk/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.2.0/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
from /Users/hayk/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.2.0/lib/bundler/runtime.rb:66:in `each'
from /Users/hayk/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.2.0/lib/bundler/runtime.rb:66:in `block in require'
from /Users/hayk/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.2.0/lib/bundler/runtime.rb:55:in `each'
from /Users/hayk/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.2.0/lib/bundler/runtime.rb:55:in `require'
from /Users/hayk/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.2.0/lib/bundler.rb:128:in `require'
from /Users/hayk/ror/bsapp/config/application.rb:7:in `<top (required)>'
from /Users/hayk/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.1.0/lib/rails/commands.rb:21:in `require'
from /Users/hayk/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.1.0/lib/rails/commands.rb:21:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Hayk-Saakians-Mac:bsapp hayk$
full source: http://pastebin.com/nXBcq2bB
The root of the problem was a bad/old/nonexistent installation of v8/therubyracer/libv8
Certain versions of the libv8 gem just straight up failed to install, and the ones that did -- they took several hours, so I assumed they were hanging/crashing (I am working with a netbook, so that could be expected).
At the moment, the following configuration works for me:
gem "libv8", "3.11.8.13"
gem "therubyracer", :require => 'v8'
gem "less-rails"
gem "twitter-bootstrap-rails"
in development, and in production (heroku)
There was a github issue on either rubyracer or libv8 related to this that mentioned issues with x86/32bit processors -- i don't remember it offhand.

could not run generate statements after installing rails plugin

I tried installing the paperclip plugin from my rails project root directory, by
rails plugin install http://github.com/thoughtbot/paperclip.git
vendor/plugins/paperclip was created successfully. But after that i could not run any generate (rails generate scaffold ) commands . I'm getting error as
D:\rr\pr2>rails g scaffold car name:string
D:/sprtcr/ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.1.0/lib/active_support/d
ependencies.rb:240:in `require': no such file to load -- cocaine (LoadError)
from D:/sprtcr/ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.1.0/lib/act
ive_support/dependencies.rb:240:in `block in require'
from D:/sprtcr/ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.1.0/lib/act
ive_support/dependencies.rb:223:in `block in load_dependency'
from D:/sprtcr/ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.1.0/lib/act
ive_support/dependencies.rb:640:in `new_constants_in'
from D:/sprtcr/ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.1.0/lib/act
ive_support/dependencies.rb:223:in `load_dependency'
from D:/sprtcr/ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.1.0/lib/act
ive_support/dependencies.rb:240:in `require'
from D:/rr/pr2/vendor/plugins/paperclip/lib/paperclip.rb:45:in `<top (re
quired)>'
from D:/sprtcr/ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.1.0/lib/act
ive_support/dependencies.rb:240:in `require'
from D:/sprtcr/ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.1.0/lib/act
ive_support/dependencies.rb:240:in `block in require'
from D:/sprtcr/ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.1.0/lib/act
ive_support/dependencies.rb:223:in `block in load_dependency'
from D:/sprtcr/ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.1.0/lib/act
ive_support/dependencies.rb:640:in `new_constants_in'
from D:/sprtcr/ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.1.0/lib/act
ive_support/dependencies.rb:223:in `load_dependency'
from D:/sprtcr/ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.1.0/lib/act
ive_support/dependencies.rb:240:in `require'
from D:/rr/pr2/vendor/plugins/paperclip/init.rb:1:in `block in <class:Pl
ugin>'
from D:/sprtcr/ruby/lib/ruby/gems/1.9.1/gems/railties-3.1.0/lib/rails/pl
ugin.rb:80:in `eval'
from D:/sprtcr/ruby/lib/ruby/gems/1.9.1/gems/railties-3.1.0/lib/rails/pl
ugin.rb:80:in `block in <class:Plugin>'
from D:/sprtcr/ruby/lib/ruby/gems/1.9.1/gems/railties-3.1.0/lib/rails/in
itializable.rb:25:in `instance_exec'
from D:/sprtcr/ruby/lib/ruby/gems/1.9.1/gems/railties-3.1.0/lib/rails/in
itializable.rb:25:in `run'
from D:/sprtcr/ruby/lib/ruby/gems/1.9.1/gems/railties-3.1.0/lib/rails/in
itializable.rb:50:in `block in run_initializers'
from D:/sprtcr/ruby/lib/ruby/gems/1.9.1/gems/railties-3.1.0/lib/rails/in
itializable.rb:49:in `each'
from D:/sprtcr/ruby/lib/ruby/gems/1.9.1/gems/railties-3.1.0/lib/rails/in
itializable.rb:49:in `run_initializers'
from D:/sprtcr/ruby/lib/ruby/gems/1.9.1/gems/railties-3.1.0/lib/rails/ap
plication.rb:92:in `initialize!'
from D:/sprtcr/ruby/lib/ruby/gems/1.9.1/gems/railties-3.1.0/lib/rails/ra
iltie/configurable.rb:30:in `method_missing'
from D:/rr/pr2/config/environment.rb:5:in `<top (required)>'
from D:/sprtcr/ruby/lib/ruby/gems/1.9.1/gems/railties-3.1.0/lib/rails/ap
plication.rb:78:in `require'
from D:/sprtcr/ruby/lib/ruby/gems/1.9.1/gems/railties-3.1.0/lib/rails/ap
plication.rb:78:in `require_environment!'
from D:/sprtcr/ruby/lib/ruby/gems/1.9.1/gems/railties-3.1.0/lib/rails/co
mmands.rb:22:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
By installing this gem as a plugin, you're not going to get the dependencies that the gem requires. The paperclip gem depends on another gem called cocaine.
I would really recommend installing the paperclip gem by putting it into your Gemfile and running bundle install.
This is why you should use gems rather than plugins.

Rails error: `rescue in <top (required)>': uninitialized constant Bundler (NameError)

Earlier today I updated gems on my system with:
gem update
It updated few gems but after that I can't start my rails server, I get this error:
/Users/gugguson/rubys/my_rails_app/config/boot.rb:9:in `rescue in <top (required)>': uninitialized constant Bundler (NameError)
from /Users/gugguson/rubys/my_rails_app/config/boot.rb:5:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from script/rails:5:in `<main>'
If I create a new app with:
rails new test99
... and then go into the folder and run rails server s I get this error:
[~/rubys/test99] rails s
<internal:gem_prelude>:168:in `load_full_rubygems_library': undefined local variable or method `path' for Gem::QuickLoader:Module (NameError)
from /Users/gugguson/.rvm/gems/ruby-head/gems/bundler-1.0.10/lib/bundler/rubygems_ext.rb:5:in `<top (required)>'
from /Users/gugguson/.rvm/rubies/ruby-head/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /Users/gugguson/.rvm/rubies/ruby-head/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /Users/gugguson/.rvm/gems/ruby-head/gems/bundler-1.0.10/lib/bundler.rb:11:in `<top (required)>'
from /Users/gugguson/.rvm/rubies/ruby-head/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /Users/gugguson/.rvm/rubies/ruby-head/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /Users/gugguson/.rvm/gems/ruby-head/gems/bundler-1.0.10/lib/bundler/setup.rb:4:in `<top (required)>'
from /Users/gugguson/.rvm/rubies/ruby-head/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:53:in `require'
from /Users/gugguson/.rvm/rubies/ruby-head/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:53:in `rescue in require'
from /Users/gugguson/.rvm/rubies/ruby-head/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
from /Users/gugguson/rubys/test99/config/boot.rb:6:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from script/rails:5:in `<main>'
Any ideas?
Thanks,
Johann
As lebreeze said, try updating rubygems with gem update --system. Looks like there were some issues and that they were fixed in recent versions.