简体   繁体   中英

passenger-install-apache2-module command fails

I'm using Ubuntu 14.04 x32, and I'm following the steps in the "Agile Web Development with Rails 4" book to setup my server using RVM. I've gotten to the part to where I need to install passenger and I've ran into a problem.

When I execute gem install passenger --version 4.0.8 that works, but then the next command it says to execute passenger-install-apache2-module fails with the following error.

/usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/dependency.rb:315:in `to_specs': Could not find 'passenger' (>= 0) among 60 total gem(s) (Gem::LoadError)
Checked in 'GEM_PATH=/home/rails/vendor/bundle/ruby/2.2.0', execute `gem env` for more information
    from /usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/dependency.rb:324:in `to_spec'
    from /usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_gem.rb:64:in `gem'
    from /usr/local/rvm/gems/ruby-2.2.1/bin/passenger-install-apache2-module:22:in `<main>'
    from /usr/local/rvm/gems/ruby-2.2.1/bin/ruby_executable_hooks:15:in `eval'
    from /usr/local/rvm/gems/ruby-2.2.1/bin/ruby_executable_hooks:15:in `<main>'

I checked the gem env command as is mentioned to get more information and it seems that the "GEM_PATH" is different.

Command checks for /home/rails/vendor/bundle/ruby/2.2.0 .

gem env states the GEM_PATH as, /usr/local/rvm/gems/ruby-2.2.1

I'm not sure if or how to change the path to match the 2.2.1 path though, perhaps this isn't even the problem. Thanks!

Try to type:

rvmsudo passenger-install-apache2-module

Cause:

The operating system looks up commands using the PATH environment variable. However, sudo resets all environment variables to a default value, dictated by sudo. If Passenger was installed to a location that is not in the default sudo PATH value, then sudo will not be able to find the Passenger commands.

In addition, if you installed Passenger using a Ruby interpreter that was installed through RVM, then you must use rvmsudo instead of sudo. As a rule, when you're an RVM user, always use rvmsudo instead of sudo.

I found my way to this page here... https://github.com/projecthydra-labs/hydradam/wiki/Installation:-Apache-&-Passenger

They recommended typing out the path to the gem. After looking around a bit I found the gem located in...

/usr/local/rvm/gems/ruby-2.2.1/gems/passenger-5.0.4/bin/passenger-install-apache2-module

When I ran that from console it worked.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM