我在win7 64位和mysql 5.1上运行rails 3时遇到错误。
它与mysql2有关。任何帮助都会有所帮助。
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>
答案 0 :(得分:3)
您提供的输出中的最后一行清楚地表明您缺少的内容。提到没有安装gem mysql2
,你应该运行bundle install
来安装它们。
你没有提到你是如何获得这个版本的Ruby的,但我会假设你安装了Rubyinstaller个软件包。
现在,mysql2 gem目前缺少Windows的二进制文件(这是我现在正在研究的东西)。
我有两个建议:要么使用sqlite3(它应该与RubyInstaller或特殊RailsInstaller包一起使用。
或者按照与RubyInstaller wiki中发布的有关安装和编译MySQL适配器的类似指示安装和编译mysql2 gem。
希望这一切都有帮助或有意义。
答案 1 :(得分:1)
我解决了这个..我只是进入了gemfile并将mysql2引用更改为mysql并且工作正常......