I get the following error on any call to rake. I am working on a Rails 3 running on JRuby (1.5.1) installed with RVM. I don't think this was always the case, but I'm not sure how to track it down. Am I correct in think this has something to do with the gems I have installed (listing included below)?
$ rake metrics:all
/Users/Eric/.rvm/gems/jruby-1.5.1#backend/bin/rake: line 9: require: command not found
/Users/Eric/.rvm/gems/jruby-1.5.1#backend/bin/rake: line 11: version: command not found
/Users/Eric/.rvm/gems/jruby-1.5.1#backend/bin/rake: line 13: syntax error near unexpected token `('
/Users/Eric/.rvm/gems/jruby-1.5.1#backend/bin/rake: line 13: `if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then'
*** LOCAL GEMS ***
abstract (1.0.0)
actionmailer (3.0.0.beta4)
actionpack (3.0.0.beta4)
activemodel (3.0.0.beta4)
activerecord (3.0.0.beta4)
activerecord-jdbc-adapter (0.9.7)
activeresource (3.0.0.beta4)
activesupport (3.0.0.beta4)
arel (0.4.0)
arrayfields (4.7.4)
autotest (4.3.2)
autotest-growl (0.2.4)
autotest-rails (4.1.0)
builder (2.1.2)
bundler (0.9.26)
capybara (0.3.9)
chronic (0.2.3)
churn (0.0.12)
configuration (1.1.0)
cucumber (0.8.3)
cucumber-rails (0.3.2)
culerity (0.2.10)
database_cleaner (0.5.2)
diff-lcs (1.1.2)
erubis (2.6.6)
factory_girl (1.3.1)
factory_girl_rails (1.0)
fattr (2.1.0)
ffi (0.6.3)
flay (1.4.0)
flog (2.2.0)
gherkin (2.0.2)
hirb (0.3.2)
hoe (2.6.1)
hoptoad_notifier (2.3.2)
i18n (0.4.1)
jdbc-mysql (5.0.4)
jruby-openssl (0.7)
json (1.4.3)
json-jruby (1.4.3.1)
json_pure (1.4.3)
launchy (0.3.5)
mail (2.2.5)
main (4.2.0)
mechanize (1.0.0)
mime-types (1.16)
nokogiri (1.4.2)
open_gem (1.4.2)
pickle (0.3.0)
polyglot (0.3.1)
rack (1.1.0)
rack-mount (0.6.6)
rack-test (0.5.4)
rails (3.0.0.beta4)
railties (3.0.0.beta4)
rake (0.8.7)
rcov (0.9.8)
rdoc (2.5.9)
redis (2.0.3)
redis-namespace (0.7.0)
resque (1.9.7)
rspec (2.0.0.beta.16, 1.3.0)
rspec-core (2.0.0.beta.16)
rspec-expectations (2.0.0.beta.16)
rspec-mocks (2.0.0.beta.16)
rspec-rails (2.0.0.beta.16)
ruby_parser (2.0.4)
rubyforge (2.0.4)
rvm (0.1.41)
Saikuro (1.1.0)
selenium-webdriver (0.0.24)
sexp_processor (3.0.4)
shoulda (2.11.1)
sinatra (1.0)
spork (0.8.4)
term-ansicolor (1.0.5)
thor (0.13.7)
treetop (1.4.8)
trollop (1.16.2)
tzinfo (0.3.22)
vegas (0.1.7)
weakling (0.0.4)
webrat (0.7.1)
ZenTest (4.3.3)
The shell is interpreting the bin/rake script as a Bash script, not a Ruby script. You might check the shebang line at the top of bin/rake and/or reinstall rake. If that fails to fix the issue, you can run like jruby -S rake instead.
Related
When I try to start my project using rails s I have the following error message occur:
Could not find gem 'jquery-rails (>= 0) ruby' in the gems available on this machine.
Run `bundle install` to install missing gems.
However, I know I definitely have that gem installed because when I put in the command gem list it shows up in my list of gems.
*** LOCAL GEMS ***
actionmailer (3.2.3)
actionpack (3.2.3)
activemodel (3.2.3)
activerecord (3.2.3)
activeresource (3.2.3)
activesupport (3.2.14, 3.2.3)
arel (3.0.2)
bigdecimal (1.1.0)
builder (3.2.2, 3.0.0)
bundler (1.1.5)
c2c_linux_patch_utilities (0.30.0, 0.29.0)
chef (11.6.2)
chef-zero (1.6)
debug_me (0.5.1)
diff-lcs (1.1.3)
erubis (2.7.0)
gelf (1.1.3)
hashie (2.0.5)
highline (1.6.19)
hike (1.2.1)
i18n (0.6.5)
io-console (0.3)
ipaddress (0.8.0)
journey (1.0.3)
jquery-rails (2.0.1)
json (1.7.7, 1.5.5)
knife-lastrun (0.0.4)
mail (2.4.4)
mime-types (1.25)
minitest (3.2.0, 2.5.1)
mixlib-authentication (1.3.0)
mixlib-cli (1.3.0)
mixlib-config (1.1.2)
mixlib-log (1.6.0)
mixlib-shellout (1.2.0)
moneta (0.6.0)
multi_json (1.8.1)
net-ssh (2.7.0)
net-ssh-gateway (1.2.0)
net-ssh-multi (1.2.0, 1.1)
ohai (6.18.0)
polyglot (0.3.3)
pony (1.4, 1.3)
poseidon (0.0.4)
puma (1.6.3)
rack (1.5.2, 1.4.1)
rack-cache (1.2)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (3.2.3)
railties (3.2.3)
rake (10.1.0, 0.9.2.2)
rdoc (3.12.2, 3.9.5)
rest-client (1.6.7)
rspec (2.12.0)
rspec-core (2.12.2)
rspec-expectations (2.12.1)
rspec-mocks (2.12.2)
rspec_junit_formatter (0.1.6)
ruby-shadow (2.2.0)
sdoc (0.3.20)
simplecov (0.7.1)
simplecov-html (0.7.1)
sprockets (2.3.1, 2.1.2)
systemu (2.5.2, 2.5.1)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
tzinfo (0.3.31)
xml-simple (1.1.1)
yajl-ruby (1.1.0)
I'm not able to use bundler because the connection is blocked at my workplace, but regardless, why is it giving me the error that the gem needs to be installed when it is installed?
Edit: I used gem environment gemdir to see where my path was for my gems and then tried to set the path for where bundlers looked using bundle config path /installationPath/, but I'm still having the same errors.
Also it is not a problem with the version numbers of the gems in my Gemfile
Bundler messes with the gem load path. gem list shows you what's installed on the system, but not necessarily what Bundler will expose to the application. Have you tried bundle exec rails s or bundle list to see what Bundler is actually exposing?
I am having problems installing the poltergeist gem. I receive the following error:
ERROR: Error installing poltergeist:
poltergeist requires Ruby version >= 1.9.2.
I am using ruby-2.0.0-p195 on a OS X Mountain Lion v10.8.4. My gem list is as follows:
*** LOCAL GEMS ***
actionmailer (3.2.13)
actionpack (3.2.13)
activemodel (3.2.13)
activerecord (3.2.13)
activeresource (3.2.13)
activesupport (3.2.13)
addressable (2.3.4)
albacore (0.3.5)
arel (3.0.2)
atomic (1.1.10)
builder (3.2.2, 3.0.4)
bundler (1.3.5)
capybara (2.1.0)
capybara-screenshot (0.3.13)
childprocess (0.3.9)
chromedriver-helper (0.0.5)
chronic (0.9.1)
cucumber (1.3.2)
data_magic (0.14)
diff-lcs (1.2.4)
erubis (2.7.0)
eventmachine (1.0.3)
faker (1.1.2)
faye-websocket (0.4.7)
ffi (1.9.0)
gherkin (2.12.0)
headless (1.0.1)
hike (1.2.3)
http_parser.rb (0.5.3)
httpclient (2.3.3)
i18n (0.6.4, 0.6.1)
jar_wrapper (0.1.7)
journey (1.0.4)
mail (2.5.4)
mime-types (1.23)
mini_portile (0.5.0)
minitest (4.7.5)
multi_json (1.7.6)
nokogiri (1.6.0)
page-object (0.9.0)
page_navigation (0.9)
polyglot (0.3.3)
rack (1.5.2, 1.4.5)
rack-cache (1.2)
rack-test (0.6.2)
rake (10.0.4)
rspec (2.13.0)
rspec-core (2.13.1)
rspec-expectations (2.13.0)
rspec-mocks (2.13.1)
ruby (0.1.0)
rubygems-bundler (1.1.1)
rubyzip (0.9.9)
rvm (1.11.3.7)
selenium (0.2.10)
selenium-webdriver (2.33.0)
sprockets (2.2.2)
thread_safe (0.1.0)
tilt (1.4.1)
treetop (1.4.14)
tzinfo (0.3.37)
watir-webdriver (0.6.4)
websocket (1.0.7)
xpath (2.0.0)
yml_reader (0.2)
zip (2.0.2)
I am presuming the poltergeist gem should be compatible with ruby 2.0 as version 1.3.0 is quite recent. The page - http://rubygems.org/gems/poltergeist lists the following gems as dependencies:
capybara ~> 2.1.0
faye-websocket < 0.5.0, >= 0.4.4
http_parser.rb ~> 0.5.3
As you can see from my gem list I have the gems installed but yet I get the error.
Anybody got any idea why I am getting the error?
Got this sorted.
I ran the command rvm use 2.0, then gem install poltergeist and it installed successfully.
(Note: I found the same issue on stackoverflow but it didn't solve my issue so I'm going to provide more information about.)
I set up an RoR environment. It contains rvm, ruby, ruby on rails and bundler. Everything seems to be correct.
I switch into this folder which contains a RoR application and try to reset the database
katarina#katarina-VirtualBox:~/RubymineProjects/prototyp1$ rake db:reset
rake aborted!
cannot load such file -- bundler/setup
(See full trace by running task with --trace)
katarina#katarina-VirtualBox:~/RubymineProjects/prototyp1$
Error: "Cannot load such file -- bundler/setup"
On the other side "bundle exec rake db:reset" works as expected.
Here my environment values:
I. ruby installation:
katarina#katarina-VirtualBox:~/RubymineProjects/prototyp1$ rvm list
rvm rubies
ruby-1.9.3-p194 [ x86_64 ]
=* ruby-1.9.3-p429 [ x86_64 ]
ruby-2.0.0-p195 [ x86_64 ]
So "ruby-1.9.3-p429" is my current and default ruby version.
II. used gemset
katarina#katarina-VirtualBox:~/RubymineProjects/prototyp1$ rvm gemset
list
gemsets for ruby-1.9.3-p429 (found in
/home/katarina/.rvm/gems/ruby-1.9.3-p429)
(default)
global
=> prototyp1
So I'm using prototyp1 gemset created inside the current ruby version.
III. contained gems:
NOte: $GEM_HOME points to the proper gemset and gem list returns an item containing the bundler.
katarina#katarina-VirtualBox:~/RubymineProjects/prototyp1$ cd $GEM_HOME
katarina#katarina-VirtualBox:~/.rvm/gems/ruby-1.9.3-p429#prototyp1$ gem list
*** LOCAL GEMS ***
actionmailer (3.2.8)
actionpack (3.2.8)
activemodel (3.2.8)
activerecord (3.2.8)
activeresource (3.2.8)
activesupport (3.2.8)
addressable (2.3.4, 2.3.3)
arel (3.0.2)
bcrypt-ruby (3.0.1)
better_errors (0.9.0)
binding_of_caller (0.7.2)
bootstrap-sass (2.3.2.0)
builder (3.0.4, 3.0.3)
bundler (1.2.0)
cancan (1.6.10)
capybara (2.1.0)
chunky_png (1.2.6)
coderay (1.0.9)
coffee-rails (3.2.2)
coffee-script (2.2.0)
coffee-script-source (1.6.2, 1.4.0, 1.3.3)
compass (0.12.2)
cucumber (1.3.2)
cucumber-rails (1.3.1)
daemons (1.1.9)
database_cleaner (1.0.1)
debug_inspector (0.0.2)
devise (2.2.4)
diff-lcs (1.2.4, 1.1.3)
email_spec (1.4.0)
erubis (2.7.0)
eventmachine (1.0.3)
excon (0.16.10)
execjs (1.4.0)
factory_girl (4.2.0)
factory_girl_rails (4.2.1)
faraday (0.8.7)
figaro (0.6.4)
fssm (0.2.9)
gherkin (2.12.0)
hashie (2.0.5)
heroku (2.35.0)
heroku-api (0.3.8)
hike (1.2.3, 1.2.1)
httpauth (0.2.0)
hub (1.10.6)
i18n (0.6.4)
journey (1.0.4)
jquery-rails (3.0.1, 2.1.4, 2.1.2)
json (1.8.0, 1.7.5)
jwt (0.1.8)
launchy (2.3.0, 2.2.0)
libv8 (3.11.8.17 x86_64-linux, 3.3.10.4 x86_64-linux)
mail (2.4.4)
mime-types (1.23, 1.19)
mini_portile (0.5.0)
multi_json (1.7.7, 1.4.0, 1.3.6)
multipart-post (1.2.0)
netrc (0.7.7)
nokogiri (1.6.0, 1.5.5)
oauth (0.4.7)
oauth2 (0.8.1)
omniauth (1.1.4)
omniauth-facebook (1.4.1)
omniauth-linkedin (0.1.0)
omniauth-oauth (1.0.1)
omniauth-oauth2 (1.1.1)
omniauth-twitter (0.0.17)
orm_adapter (0.4.0)
pg (0.14.1)
polyglot (0.3.3)
quiet_assets (1.0.2)
rack (1.5.2, 1.4.5)
rack-cache (1.2)
rack-ssl (1.3.3, 1.3.2)
rack-test (0.6.2, 0.6.1)
rails (3.2.8)
railties (3.2.8)
rake (10.0.4, 10.0.2, 0.9.2.2)
rdoc (3.12.2, 3.12)
ref (1.0.5)
rest-client (1.6.7)
rolify (3.2.0)
rspec (2.11.0, 2.0.1)
rspec-core (2.13.1, 2.11.1, 2.0.1)
rspec-expectations (2.13.0, 2.11.3, 2.0.1)
rspec-mocks (2.13.1, 2.11.3, 2.11.2, 2.0.1)
rspec-rails (2.13.2, 2.11.0, 2.0.1)
rubygems-bundler (1.1.0)
rubyzip (0.9.9)
rvm (1.11.3.5)
sass (3.2.9, 3.2.3, 3.2.1)
sass-rails (3.2.6, 3.2.5)
simple_form (2.1.0)
sprockets (2.1.3)
sqlite3 (1.3.7, 1.3.6)
therubyracer (0.11.4, 0.10.2)
thin (1.5.1, 1.5.0)
thor (0.18.1, 0.16.0)
tilt (1.4.1, 1.3.3)
treetop (1.4.14, 1.4.12, 1.4.10)
tzinfo (0.3.37, 0.3.35, 0.3.33)
uglifier (2.1.1, 1.3.0)
warden (1.2.1)
webrat (0.7.1)
webrick (1.3.1)
xpath (2.0.0)
Why am I getting the error when executing rake?
Is it an "old-fashioned" way to execute rake tasks? It is recommended to execute "bundle exec .." rather than "rake ..."?
Thank you in advance.
golbie
It is strongly recommended to execute tasks with bundle exec. It ensures the task to be executed in the context of current bundle.
I hit a bug when using Puppet and stored configs that can be be resolved by downgrading activerecord to 3.0.11. Since I have a few other rails sites running on the same server, I installed version 3.0.11 and now have 3 versions installed.
actionmailer (3.2.1, 2.3.14)
actionpack (3.2.1, 2.3.14)
activemodel (3.2.1, 3.0.11)
activerecord (3.2.1, 3.0.11, 2.3.14)
activeresource (3.2.1, 2.3.14)
activesupport (3.2.1, 3.0.11, 2.3.14)
acts-as-taggable-on (2.1.0)
arel (3.0.0, 2.0.10)
builder (3.0.0, 2.1.2)
bundler (1.0.21)
coderay (1.0.6, 0.9.8)
daemon_controller (0.2.6)
erubis (2.7.0)
facter (1.6.5)
fastercsv (1.5.4)
fastthread (1.0.7)
hiera (0.3.0)
hiera-puppet (0.3.0)
hike (1.2.1)
i18n (0.6.0, 0.5.0, 0.4.2)
journey (1.0.1)
json (1.6.5, 1.4.3)
liquid (2.3.0)
mail (2.4.1)
mime-types (1.16)
multi_json (1.0.4)
mysql (2.8.1)
mysql2 (0.2.18)
net-ldap (0.2.2)
net-scp (1.0.4)
net-sftp (2.0.5)
net-ssh (2.3.0)
passenger (3.0.11)
pg (0.9.0)
polyglot (0.3.3)
puppet (2.7.6)
puppet-lint (0.1.13)
rack (1.4.1, 1.1.3)
rack-cache (1.1)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (3.2.1, 2.3.14)
railties (3.2.1)
rake (0.9.2.2, 0.8.7)
rdoc (3.12)
rest-client (1.6.1)
rmagick (2.13.1)
ruby-openid (2.1.8)
rubytree (0.5.3)
sprockets (2.1.2)
sqlite3-ruby (1.2.5, 1.2.4)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
tzinfo (0.3.33, 0.3.31)
According to the bug report all I need to do is add gem 'activerecord', '=2.2.2' require 'activerecord' to my config.ru file to force puppet to use this version of activerecord.
I wasn't sure which config.ru file to add this line to so I tried the three with puppet and rails in the path but none worked i.e. I continued to get the same error ("stack level too deep")
$ locate config.ru
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/test/stub/rack/config.ru
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/test/stub/rails_apps/3.0/empty/config.ru
/usr/lib/ruby/gems/1.8/gems/puppet-2.7.6/ext/rack/files/config.ru
/usr/lib/ruby/gems/1.8/gems/rack-1.4.1/test/rackup/config.ru
/usr/lib/ruby/gems/1.8/gems/rack-test-0.6.1/spec/fixtures/config.ru
/usr/lib/ruby/gems/1.8/gems/rails-2.3.14/dispatches/config.ru
/usr/lib/ruby/gems/1.8/gems/railties-3.2.1/guides/code/getting_started/config.ru
/usr/lib/ruby/gems/1.8/gems/railties-3.2.1/lib/rails/generators/rails/app/templates/config.ru
/usr/share/puppet/ext/rack/files/config.ru
Any ideas on what I could do at this point to force puppet to use activerecord v.3.0.11 without having to uninstall any of the other versions?
The answer is to modify usr/lib/ruby/site_ruby/1.8/puppet/feature/rails.rb with
Puppet.features.add(:rails) do
begin
+ # http://projects.puppetlabs.com/issues/9290
+ gem 'activerecord', '=3.0.11'
require 'active_record'
require 'active_record/version'
I have screwed up my rubygem dependencies.
This is my gem list
*** LOCAL GEMS ***
actionmailer (2.3.5, 1.3.6)
actionpack (2.3.5, 1.13.6)
actionwebservice (1.2.6)
activemodel (3.0.3)
activerecord (3.0.3, 2.3.5, 1.15.6)
activeresource (3.0.3, 2.3.5)
activesupport (3.0.3, 2.3.5, 1.4.4)
acts_as_ferret (0.4.3)
builder (2.1.2)
bundler (1.0.7)
capistrano (2.5.2)
cgi_multipart_eof_fix (2.5.0)
daemons (1.0.10)
devise (1.0.5)
dnssd (0.6.0)
erubis (2.6.6)
fastthread (1.0.1)
fcgi (0.8.7)
ferret (0.11.6)
gem_plugin (0.2.3)
highline (1.5.0)
hpricot (0.6.164)
i18n (0.4.2)
libxml-ruby (1.1.2)
mail (2.2.9)
mime-types (1.16)
mongrel (1.1.5)
needle (1.3.0)
net-scp (1.0.1)
net-sftp (2.0.1, 1.1.1)
net-ssh (2.0.4, 1.1.4)
net-ssh-gateway (1.0.0)
polyglot (0.3.1)
rack (1.2.1, 1.0.1)
rack-mount (0.6.13)
rack-test (0.5.6)
rails (2.3.5, 1.2.6)
railties (3.0.3)
rake (0.8.7, 0.8.3)
RedCloth (4.1.1)
ruby-openid (2.1.2)
ruby-yadis (0.3.4)
rubygems-update (1.4.2)
rubynode (0.1.5)
sqlite3-ruby (1.2.4)
termios (0.9.4)
thor (0.14.4)
treetop (1.4.8)
tzinfo (0.3.23)
warden (1.0.3)
xmpp4r (0.4)
Now when I try to uninstall rails, I get this error
dyres212-79:~ ranjiththavamaniraj$ sudo gem uninstall rails -v 2.3.5
Password:
ERROR: While executing gem ... (Gem::InstallError)
cannot uninstall, check `gem list -d rails`
The error suggests, that version of rails may not be present to be uninstalled. In any case I suggest you use RVM. Its a much better practice, in order to manage multiple rubies and rails versions.