如何在 codenvy.io / goormide.io 中安装 gem pg 和 mysql2?
How to install gem pg and mysql2 in codenvy.io / goormide.io?
登录终端:
user@c6b65b118139:/projects/rails-jafar$ gem install pg
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
current directory: /usr/local/bundle/gems/pg-1.1.4/ext
/usr/local/bin/ruby -r ./siteconf20190831-425-ife1vi.rb extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
--with-pg-config=/path/to/pg_config
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
apt-get 安装 libmysqlclient-dev
libmysqlclient-dev E: Could not open lock file /var/lib/dpkg/lock -
open (13: Permission denied) E: Unable to lock the administration
directory (/var/lib/dpkg/), are you root?
goorm.io
我通过安装 libpq-dev
来解决
apt-get install libpq-dev
sudo apt-get update
sudo apt-get install mysql-client libmysqlclient-dev
gem install mysql2
登录终端:
user@c6b65b118139:/projects/rails-jafar$ gem install pg Building native extensions. This could take a while... ERROR: Error installing pg: ERROR: Failed to build gem native extension. current directory: /usr/local/bundle/gems/pg-1.1.4/ext /usr/local/bin/ruby -r ./siteconf20190831-425-ife1vi.rb extconf.rb checking for pg_config... no No pg_config... trying anyway. If building fails, please try again with --with-pg-config=/path/to/pg_config checking for libpq-fe.h... no Can't find the 'libpq-fe.h header *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options.
apt-get 安装 libmysqlclient-dev
libmysqlclient-dev E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied) E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
goorm.io 我通过安装 libpq-dev
来解决apt-get install libpq-dev
sudo apt-get update
sudo apt-get install mysql-client libmysqlclient-dev
gem install mysql2