无法通过“rails new todo -d mysql”创建新的应用程序

时间:2015-11-23 07:00:07

标签: mysql ruby-on-rails ruby

我想通过执行以下命令来创建一个新的rails应用程序。

$rails new todo -d mysql

但是在此过程中我收到了错误消息。

我正在使用OS X Yosemite(10.10.5)和MySQL(5.7.9)

并且Ruby版本就是这样。

请告诉我解决此错误的任何想法。

$ruby -v
ruby 2.1.7p400 (2015-08-18 revision 51632) [x86_64-darwin14.0]


$ rails new todo -d mysql
create  
create  README.rdoc
create  Rakefile
create  config.ru
create  .gitignore
create  Gemfile
create  app
create  app/assets/javascripts/application.js
create  app/assets/stylesheets/application.css
create  app/controllers/application_controller.rb
create  app/helpers/application_helper.rb
create  app/views/layouts/application.html.erb
create  app/assets/images/.keep
create  app/mailers/.keep
create  app/models/.keep
create  app/controllers/concerns/.keep
create  app/models/concerns/.keep
create  bin
create  bin/bundle
create  bin/rails
create  bin/rake
create  config
create  config/routes.rb
create  config/application.rb
create  config/environment.rb
create  config/secrets.yml
create  config/environments
create  config/environments/development.rb
create  config/environments/production.rb
create  config/environments/test.rb
create  config/initializers
create  config/initializers/backtrace_silencers.rb
create  config/initializers/cookies_serializer.rb
create  config/initializers/filter_parameter_logging.rb
create  config/initializers/inflections.rb
create  config/initializers/mime_types.rb
create  config/initializers/session_store.rb
create  config/initializers/wrap_parameters.rb
create  config/locales
create  config/locales/en.yml
create  config/boot.rb
create  config/database.yml
create  db
create  db/seeds.rb
create  lib
create  lib/tasks
create  lib/tasks/.keep
create  lib/assets
create  lib/assets/.keep
create  log
create  log/.keep
create  public
create  public/404.html
create  public/422.html
create  public/500.html
create  public/favicon.ico
create  public/robots.txt
create  test/fixtures
create  test/fixtures/.keep
create  test/controllers
create  test/controllers/.keep
create  test/mailers
create  test/mailers/.keep
create  test/models
create  test/models/.keep
create  test/helpers
create  test/helpers/.keep
create  test/integration
create  test/integration/.keep
create  test/test_helper.rb
create  tmp/cache
create  tmp/cache/assets
create  vendor/assets/javascripts
create  vendor/assets/javascripts/.keep
create  vendor/assets/stylesheets
create  vendor/assets/stylesheets/.keep
   run  bundle install
/Users/user/.rbenv/versions/2.1.7/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:128:in `require': cannot load such file -- bundler (LoadError)
  from /Users/user/.rbenv/versions/2.1.7/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:128:in `rescue in require'
  from /Users/user/.rbenv/versions/2.1.7/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:39:in `require'
  from /Users/user/.rbenv/versions/2.1.7/lib/ruby/gems/2.1.0/gems/railties-4.1.1/lib/rails/generators/app_base.rb:329:in `bundle_command'
  from /Users/user/.rbenv/versions/2.1.7/lib/ruby/gems/2.1.0/gems/railties-4.1.1/lib/rails/generators/app_base.rb:345:in `run_bundle'
  from (eval):1:in `run_bundle'
  from /Users/user/.rbenv/versions/2.1.7/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
  from /Users/user/.rbenv/versions/2.1.7/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
  from /Users/user/.rbenv/versions/2.1.7/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `block in invoke_all'
  from /Users/user/.rbenv/versions/2.1.7/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `each'
  from /Users/user/.rbenv/versions/2.1.7/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `map'
  from /Users/user/.rbenv/versions/2.1.7/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `invoke_all'
  from /Users/user/.rbenv/versions/2.1.7/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/group.rb:232:in `dispatch'
  from /Users/user/.rbenv/versions/2.1.7/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
  from /Users/user/.rbenv/versions/2.1.7/lib/ruby/gems/2.1.0/gems/railties-4.1.1/lib/rails/commands/application.rb:17:in `<top (required)>'
  from /Users/user/.rbenv/versions/2.1.7/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:69:in `require'
  from /Users/user/.rbenv/versions/2.1.7/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:69:in `require'
  from /Users/user/.rbenv/versions/2.1.7/lib/ruby/gems/2.1.0/gems/railties-4.1.1/lib/rails/cli.rb:14:in `<top (required)>'
  from /Users/user/.rbenv/versions/2.1.7/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:69:in `require'
  from /Users/user/.rbenv/versions/2.1.7/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:69:in `require'
  from /Users/user/.rbenv/versions/2.1.7/lib/ruby/gems/2.1.0/gems/railties-4.1.1/bin/rails:9:in `<top (required)>'
  from /Users/user/.rbenv/versions/2.1.7/bin/rails:23:in `load'
  from /Users/user/.rbenv/versions/2.1.7/bin/rails:23:in `<main>'

1 个答案:

答案 0 :(得分:1)

运行

gem install bundler

然后重复你的

rails new todo -d mysql