windows 7 上 ruby on Rails 3 的问题
我在 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>
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>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您提供的输出中的最后一行清楚地表明您缺少什么。提到 gem
mysql2
尚未安装,您应该运行bundle install
来安装它们。您没有提到如何获得该版本的 Ruby,但我假设您安装了 Rubyinstaller 软件包。
现在,mysql2 gem 目前缺少 Windows 的二进制文件(这是我现在正在研究的事情)。
我有两个建议:要么使用 sqlite3 (它应该与 RubyInstaller 一起开箱即用,或者专门使用 RailsInstaller 包。
或者安装并按照与 RubyInstaller wiki 中发布的有关安装和编译 MySQL 的类似说明来编译 mysql2 gem希望
这一切有帮助或有意义。
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 runbundle 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.
我解决了这个问题..我只是进入 gemfile 并将 mysql2 引用更改为 mysql,一切正常...
I resolved this..i simply went into the gemfile and changed the mysql2 references to mysql and things worked fine...