[Ruby on rails]安装环境遇到的一些问题

  • bundle报错
Can't find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException)

解决:
主要是Gemfile.lock锁住了bundle版本,因此需要安装该版本bundler,或者删除Gemfile.lock也是一种方法

$ cat Gemfile.lock | grep -A 1 "BUNDLED WITH"
BUNDLED WITH
   1.17.3

$ gem install bundler -v '1.17.3'
  • 安装mysql2报错
An error occurred while installing mysql2 (0.4.10), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.4.10' --source 'https://gems.ruby-china.com/'` succeeds before bundling.

解决:
安装中间件

# On ubuntu
sudo apt-get install libmysqlclient-dev

# On Red Hat/CentOS and other distributions using yum:
sudo yum install mysql-devel

# On Mac OS X with Homebrew:
brew install mysql

mac os如果已经安装了mysql,在bundle时出现安装openssl

猜你喜欢

转载自blog.csdn.net/qq_41037744/article/details/106049803