【问题标题】:Bundle error when trying to install Mysql in Rails App尝试在 Rails App 中安装 Mysql 时出现捆绑错误
【发布时间】:2016-01-08 20:16:09
【问题描述】:

在我的 Rails 应用程序中运行 bundle 时,我在 命令行 中得到以下 错误 输出:

Using jquery-rails 4.0.5
Using jquery-ui-rails 5.0.5
Using mail_form 1.5.1
Installing mysql 2.9.1 with native extensions

Errno::EACCES: Permission denied @ rb_sysopen - /usr/local/lib/ruby/gems/2.2.0/gems/mysql-2.9.1/COPYING
An error occurred while installing mysql (2.9.1), and Bundler cannot continue.
Make sure that `gem install mysql -v '2.9.1'` succeeds before bundling.

我正在使用: rails -v:2.2.4

在我的 gemfile 中,mysql 有以下内容:

group :development do
  # Access an IRB console on exception pages or by using <%= console %> in views
  gem 'web-console', '~> 2.0'

  gem 'mysql', '~> 2.9', '>= 2.9.1'

  # Use Capistrano for deployment
  gem 'capistrano', '~> 3.4', require: false
  gem 'capistrano-bundler', require: false
  gem 'capistrano-rails', require: false
  gem 'capistrano-rbenv', github: 'capistrano/rbenv', require: false

  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
end

如果遇到类似情况,请检查 Ruby 版本($ruby -v),发现我的版本被锁定为 2.0.0 和旧版本。 要修复此运行:

$ env | grep PATH
$ export PATH="$HOME/.rbenv/bin:$PATH"
$ eval "$(rbenv init -)"

【问题讨论】:

  • 你试过 brew install mysql 吗?
  • 当我尝试运行时收到警告:警告:mysql-5.7.10 已经安装,只是没有链接@ruby_newbie
  • 你能更新到最新的捆绑器再试一次吗?
  • 是的,我也试过了,我在另一个对某些人有用的博客上读过。对我来说不是那么多。
  • 尝试 brew uninstall pg、brew install pg、brew update pg,然后尝试捆绑。

标签: mysql ruby-on-rails rubygems bundler web-deployment


【解决方案1】:

所以,这最终变得非常简单。卸载并重新安装几个 gem 后。我发现 ruby​​ 版本由于某种原因被锁定为 2.0.0。我已经添加了上面的修复程序。

【讨论】:

    猜你喜欢
    • 2021-05-25
    • 2017-07-11
    • 1970-01-01
    • 2013-03-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-08-23
    相关资源
    最近更新 更多