【问题标题】:Bundle install --deployment not working with "gcc: Permission denied"捆绑安装 --deployment 不适用于“gcc:权限被拒绝”
【发布时间】:2013-08-11 11:37:19
【问题描述】:

我一直在设置我的服务器以在其上运行 Rails 应用程序,最近开始配置 Capistrano 以进行部署。部署本身似乎相当一致,但在尝试运行 bundle install --deployment 时失败。日志摘录:

 Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
 /usr/local/bin/ruby extconf.rb
 creating Makefile
 make
 compiling crypt_blowfish.c
 make: execvp: gcc: Permission denied
 make: *** [crypt_blowfish.o] Error 127
 Gem files will remain installed in /home/.../public_html/v4/shared/bundle/ruby/2.0.0/gems/bcrypt-ruby-3.0.1 for inspection.
 Results logged to /home/.../public_html/v4/shared/bundle/ruby/2.0.0/gems/bcrypt-ruby-3.0.1/ext/mri/gem_make.out
 An error occurred while installing bcrypt-ruby (3.0.1), and Bundler cannot
 continue.
 Make sure that `gem install bcrypt-ruby -v '3.0.1'` succeeds before bundling.

不管怎样,gem install bcrypt-ruby -v '3.0.1' 以非 root 用户身份失败(即使具有 sudo 权限)。它确实以 root 用户身份工作。

gem_make.out 日志显示:

/usr/local/bin/ruby extconf.rb
creating Makefile

make
compiling crypt_blowfish.c
make: execvp: gcc: Permission denied
make: *** [crypt_blowfish.o] Error 127

权限被拒绝。这很有趣,因为我认为这就是使用bundle install --deployment 的意义所在。我到处找,没有发现任何有用的东西。

我有一种感觉,这可能与 ruby​​ 可能是以 root 用户身份安装的事实有关。也就是说——当我到达服务器时它已经安装好了。我尝试使用 RVM 重新安装 ruby​​(作为非 root 用户,尽管我得到了相同的结果)并得到:

Searching for binary rubies, this might take some time.
Installing requirements for centos, might require sudo password.
Installing required packages: gcc-c++, libyaml-devel, libffi-devel...................................................................................
Error running 'requirements_centos_libs_install gcc-c++ libyaml-devel libffi-devel',
please read /home/.../.rvm/log/ruby-2.0.0-p247/1376056268_package_install_gcc-c++_libyaml-devel_libffi-devel.log

那里的日志说...

Transaction Check Error:
  package libgcc-4.4.7-3.el6.x86_64 is already installed
  package glibc-2.12-1.107.el6_4.2.x86_64 is already installed
  package gmp-4.3.1-7.el6_2.2.x86_64 is already installed
  package mpfr-2.4.1-6.el6.x86_64 is already installed
  package nss-softokn-freebl-3.14.3-3.el6_4.x86_64 is already installed
  package libstdc++-4.4.7-3.el6.x86_64 is already installed
  package libffi-3.0.5-3.2.el6.x86_64 is already installed
  file /sbin/ldconfig from install of glibc-2.12-1.107.el6_4.2.x86_64 conflicts with file from package glibc-2.12-1.107.el6_4.2.i686
  file /sbin/sln from install of glibc-2.12-1.107.el6_4.2.x86_64 conflicts with file from package glibc-2.12-1.107.el6_4.2.i686
  file /usr/sbin/iconvconfig from install of glibc-2.12-1.107.el6_4.2.x86_64 conflicts with file from package glibc-2.12-1.107.el6_4.2.i686

长话短说,我有点不知所措。

运行 CentOS 6.4 / cPanel。

提前感谢您的帮助!

【问题讨论】:

  • 你试过sudo bundle install --deployment吗?
  • 试过了,但没有运气。 sudo -i bundle install ERROR: RVM Ruby not used, run rvm 首先使用 2.0.0`。` sudo bundle install sudo: bundle: command not found`

标签: ruby-on-rails ruby capistrano


【解决方案1】:

您是否尝试过完全删除 ruby​​ 并使用 rvm 重新安装,而不是仅仅重新安装它?

【讨论】:

  • 谢谢!我已经尝试过了,但我仍然收到package glibc-2.12-1.107.el6_4.2.x86_64 is already installed etc. etc. 错误。
  • 尝试删除 glibc-2.12-1.107.el6_4.2.i686 并重做该过程。
  • 试一试 -- Error: Trying to remove "yum", which is protected 完全终止通话。
【解决方案2】:

想通了。

事实证明这里有几个问题:

  1. 您不能在 cPanel 服务器上安装 RVM
  2. 如果您不是 root 用户(在 cPanel 服务器上),也无法在没有 sudo 命令的情况下安装 gems。

我最终在此处以相关用户的身份安装了 ruby​​(在this guide 之后)并且或多或少地得到了我想要的。

我需要sudo bundle install --deployment 才能真正让它发挥作用,但除此之外,这对我有用。

谢谢大家的帮助!

【讨论】:

    【解决方案3】:

    您可以尝试修复rvm 权限:

    rvmsudo rvm cleanup all
    

    理论上,在使用rvm 时永远不需要sudo

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-08-27
      • 2015-10-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多