为什么会收到此错误`即使安装了mysql并且存在gem,安装mysql2(0.5.2)...时也会发生错误?

时间:2019-09-08 14:07:42

标签: mysql ruby-on-rails rubygems redmine mysql2

为此,我已经花了好几天的脑筋,然后谷歌搜索。我已经在Stackoverflow上尝试了几种选择,但均未成功。大部分建议是对brew install mysql的建议。

我已经通过FTP传输了rails(redmine)网络应用程序。我在应用程序的根目录中。运行任何rails(例如rails --version)命令都会导致以下错误结尾:

[...]
Could not find mysql2-0.5.2 in any of the sources
Run `bundle install` to install missing gems.

根据消息中的建议,我运行bundle install,并得到熟悉的错误,包括:

[...]
Fetching mysql2 0.5.2
Installing mysql2 0.5.2 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
[...]
An error occurred while installing mysql2 (0.5.2), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.5.2' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  mysql2

根据消息中的建议,我运行gem install mysql2 -v '0.5.2' --source 'https://rubygems.org/'

ERROR:  While executing gem ... (Errno::EACCES)
    Permission denied @ rb_sysopen - /Users/frontwalkermalmo/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/mysql2-0.5.2/CHANGELOG.md

为了确定,我运行sudo gem install mysql2 -v '0.5.2' --source 'https://rubygems.org/',它会产生一些错误消息,其中包括:

[...]
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [mysql2.bundle] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/[USER]/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/mysql2-0.5.2 for inspection.
Results logged to /Users/[USER]/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/extensions/x86_64-darwin-18/2.5.0-static/mysql2-0.5.2/gem_make.out

运行mysql --version会产生:

mysql  Ver 14.14 Distrib 5.6.43, for osx10.14 (x86_64) using  EditLine wrapper

#其他信息#

我有一个wordpress网站,可以使用MAMP和mysql服务器在目录中正常工作。

  • 服务器:通过UNIX套接字的Localhost
  • 服务器类型:MySQL
  • 服务器连接:未使用SSL进行文件
  • 服务器版本:5.7.26-MySQL社区服务器(GPL)
  • Protokollversion:10
  • Användare:root @ localhost
  • 服务器信息:UTF-8 Unicode(utf8)

问题[1]:这是否引起我无法安装mysql2 gem的任何问题?

此外,在Redmine项目应用程序的根目录中,运行mysqlserverinfo时请给我:zsh: command not found: mysqlserverinfo

问题[2]:这有助于诊断问题吗?

此外,这也是echo $PATH的输出:

/usr/local/opt/imagemagick@6/bin:/usr/local/opt/mysql@5.6/bin:/Users/[USER_ACCT]/.rbenv/shims:/Users/[USER_ACCT]/.rbenv/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

0 个答案:

没有答案