windows 7 上 ruby​​ on Rails 3 的问题

发布于 2024-10-30 02:13:07 字数 2893 浏览 1 评论 0原文

我在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

海螺姑娘 2024-11-06 02:13:07

您提供的输出中的最后一行清楚地表明您缺少什么。提到 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 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.

や三分注定 2024-11-06 02:13:07

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

I resolved this..i simply went into the gemfile and changed the mysql2 references to mysql and things worked fine...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文