Problem with Ruby on Rails with Rake

I am very new to Rails, so please forgive my lack of understanding. I installed the latest versions of RubyGems, Ruby, Rails, Rake and MySQL, etc. Using RubyGems, but I had this problem when I started to build a basic Rails application:

Icarus:temporary atg$ rails new people
    ... (output omitted) ...
Icarus:temporary atg$ cd people
Icarus:people atg$ rake db:create
(in /Users/atg/temporary/people)
rake aborted!
uninitialized constant Bundler
/Users/atg/temporary/people/Rakefile:4
(See full trace by running task with --trace)
Icarus:people atg$ rake db:create --trace
(in /Users/atg/temporary/people)
rake aborted!
uninitialized constant Bundler
/Users/atg/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2503:in `const_missing'
/Users/atg/temporary/people/config/boot.rb:9
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
/Users/atg/temporary/people/config/application.rb:1
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
/Users/atg/temporary/people/Rakefile:4
/Users/atg/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2383:in `load'
/Users/atg/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2383:in `raw_load_rakefile'
/Users/atg/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2017:in `load_rakefile'
/Users/atg/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Users/atg/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2016:in `load_rakefile'
/Users/atg/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2000:in `run'
/Users/atg/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Users/atg/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/Users/atg/.gem/ruby/1.8/gems/rake-0.8.7/bin/rake:31
/usr/bin/rake:19:in `load'
/usr/bin/rake:19

I have no idea what I did wrong, and I'm so new to it that I don’t know that I could debug it if I had been working on it all my life - any ideas / guidance?

All help is appreciated and thanks in advance!

+3
source share
3 answers

Rails 2.3.8, . ; 3.0 . 2.3.8 3.0.0.

+2

Bundler - Ruby Rails.

# ask rubygems to install bundler
$ gem install bundler

# ask bundler to install your app dependencies
$ bundle install

# run your app & tasks using bundler
$ bundle exec rake db:create
+2

:

rake aborted!
uninitialized constant Bundler

, , , cron, , env . .profile .bash_profile cron. , PATH crontab , :

PATH=/opt/nginx/sbin:/usr/local/mysql/bin:/opt/local/bin:/opt/local/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/Applications/sshfs/bin

, ,

which ruby

from inside the shell and from inside the cron task. If you get different results, this indicates that the cron task does not work with the same ruby ​​as in the shell, and that the ruby ​​task performed by cron does not have a Bundler gem installed.

0
source

Source: https://habr.com/ru/post/1763523/


All Articles