简体   繁体   中英

problems with ruby on rails 3 on windows 7

I have run into an error while running rails 3 on win7 64 bit and mysql 5.1.

It has to do with mysql2. Any assistance would be helpful.

C:\mobile_projects>rails new test2 -d mysql
      create  
      create  README
      create  Rakefile
      create  config.ru
      create  .gitignore
      create  Gemfile
      create  app
      create  app/controllers/application_controller.rb
      create  app/helpers/application_helper.rb
      create  app/mailers
      create  app/models
      create  app/views/layouts/application.html.erb
      create  config
      create  config/routes.rb
      create  config/application.rb
      create  config/environment.rb
      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/inflections.rb
      create  config/initializers/mime_types.rb
      create  config/initializers/secret_token.rb
      create  config/initializers/session_store.rb
      create  config/locales
      create  config/locales/en.yml
      create  config/boot.rb
      create  config/database.yml
      create  db
      create  db/seeds.rb
      create  doc
      create  doc/README_FOR_APP
      create  lib
      create  lib/tasks
      create  lib/tasks/.gitkeep
      create  log
      create  log/server.log
      create  log/production.log
      create  log/development.log
      create  log/test.log
      create  public
      create  public/404.html
      create  public/422.html
      create  public/500.html
          create  public/favicon.ico
      create  public/index.html
      create  public/robots.txt
      create  public/images
      create  public/images/rails.png
      create  public/stylesheets
      create  public/stylesheets/.gitkeep
      create  public/javascripts
      create  public/javascripts/application.js
      create  public/javascripts/controls.js
      create  public/javascripts/dragdrop.js
      create  public/javascripts/effects.js
      create  public/javascripts/prototype.js
      create  public/javascripts/rails.js
      create  script
      create  script/rails
      create  test
      create  test/fixtures
      create  test/functional
      create  test/integration
      create  test/performance/browsing_test.rb
      create  test/test_helper.rb
      create  test/unit
      create  tmp
      create  tmp/sessions
      create  tmp/sockets
      create  tmp/cache
      create  tmp/pids
      create  vendor/plugins
      create  vendor/plugins/.gitkeep

C:\mobile_projects>cd test2

C:\mobile_projects\test2>rails generate scaffold testtbl desc:string legsnumber:string
[31mCould not find gem 'mysql2 (>= 0, runtime)' in any of the gem sources listed in your Gemfile.[0m

C:\mobile_projects\test2>

The last line in the output you provided is clearly indicating what you're missing. It is mentioning that the gem mysql2 is not installed, and that you should run bundle install to install them.

You didn't mention how you obtained that version of Ruby, but I will assume you installed Rubyinstaller packages.

Now, mysql2 gem lacks binaries for Windows at this time (it is something I'm working on right now).

I have two recommendations: either you use sqlite3 (which should work out of the box with RubyInstaller or specially RailsInstaller package.

Or you install and compile mysql2 gem following similar instructions to the ones posted in RubyInstaller wiki about installing and compiling MySQL adapter.

Hope all this helps or makes sense.

我解决了这个..i只是进入了gemfile并将mysql2的引用更改为mysql,并且一切正常。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM