我试图使用postgresql数据库在rails项目上设置ruby,这种情况正在发生:
当我添加gem' pg'到gemfile并运行bundle install
这是输出:
An error occurred while installing pg (0.18.4), and Bundler cannot continue.
Make sure that `gem install pg -v '0.18.4'` succeeds before bundling.
当我运行gem install pg -v '0.18.4'
时会发生这种情况:
ERROR: While executing gem ... (Errno::EACCES)
Permission denied @ rb_sysopen
当我运行sudo gem install pg -v '0.18.4'
时:
Building native extensions. This could take a while...
Successfully installed pg-0.18.4
1 gem installed
Installing ri documentation for pg-0.18.4...
Installing RDoc documentation for pg-0.18.4...
当我运行sudo bundle install
时:
An error occurred while installing mime-types-data (3.2016.0221), and Bundler cannot continue.
Make sure that `gem install mime-types-data -v '3.2016.0221'` succeeds before bundling.
当我运行sudo gem install mime-types-data -v '3.2016.0221'
ERROR: Error installing mime-types-data:
mime-types-data requires Ruby version >= 2.0.
当我运行ruby -v
时:
ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-linux]
当我运行sudo ruby -v
时:
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux
我使用rbenv。有几个关于我遇到的问题的帖子,我尝试了几件事,但似乎没有什么能帮到我。这是我已经尝试过的:
sudo apt-get install libpq-dev (I use Ubuntu)
来自Error message: Make sure that `gem install pg -v '0.18.1'` succeeds before bundling
的可能解决方案which pg_config
this will return ==> /usr/pgsql-9.1/bin/pg_config
now use this path as
bundle config build.pg --with-pg-config=/usr/pgsql-9.1/bin/pg_config
Done now bundle install
没有工作。在这一点上,我迷失了。我在rails项目上有另一个ruby,它运行没有问题,但是我启动的每个新项目都有这个问题。有什么建议吗?
答案 0 :(得分:0)
我删除了Ruby并且我重新安装了Ruby,它现在似乎正在运行。