[英]Rails error “could nof find pg-0.18.3 in any of the sources” after Nginx restart
我正在尝试在Nginx上设置Rails 4.2一段时间。 每次我使用RVM开始全新安装时,它都会变好。 我可以运行rake db:create:all
并创建数据库。 但是,如果我使用/etc/init.d/nginx restart
重启Nginx,旅客会向我发送有关gem的错误消息:
It looks like Bundler could not find a gem. Maybe you didn't install all the gems that this application needs. To install your gems, please run:
bundle install
If that didn't work, then the problem is probably caused by your application being run under a different environment than it's supposed to. Please check the following:
Is this app supposed to be run as the www-data user?
Is this app being run on the correct Ruby interpreter? Below you will see which Ruby interpreter Phusion Passenger attempted to use.
-------- The exception is as follows: -------
Could not find pg-0.18.3 in any of the sources (Bundler::GemNotFound)
/var/lib/gems/2.1.0/gems/bundler-1.10.6/lib/bundler/spec_set.rb:92:in `block in materialize'
/var/lib/gems/2.1.0/gems/bundler-1.10.6/lib/bundler/spec_set.rb:85:in `map!'
/var/lib/gems/2.1.0/gems/bundler-1.10.6/lib/bundler/spec_set.rb:85:in `materialize'
/var/lib/gems/2.1.0/gems/bundler-1.10.6/lib/bundler/definition.rb:140:in `specs'
/var/lib/gems/2.1.0/gems/bundler-1.10.6/lib/bundler/definition.rb:185:in `specs_for'
/var/lib/gems/2.1.0/gems/bundler-1.10.6/lib/bundler/definition.rb:174:in `requested_specs'
/var/lib/gems/2.1.0/gems/bundler-1.10.6/lib/bundler/environment.rb:18:in `requested_specs'
/var/lib/gems/2.1.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:13:in `setup'
/var/lib/gems/2.1.0/gems/bundler-1.10.6/lib/bundler.rb:127:in `setup'
/var/lib/gems/2.1.0/gems/bundler-1.10.6/lib/bundler/setup.rb:18:in `<top (required)>'
/usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:411:in `activate_gem'
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:295:in `block in run_load_path_setup_code'
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:416:in `running_bundler'
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:294:in `run_load_path_setup_code'
/usr/share/passenger/helper-scripts/rack-preloader.rb:99:in `preload_app'
/usr/share/passenger/helper-scripts/rack-preloader.rb:153:in `<module:App>'
/usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `<module:PhusionPassenger>'
/usr/share/passenger/helper-scripts/rack-preloader.rb:28:in `<main>'
pg gem已安装在我的Gemfile和RVM中:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.4'
gem 'pg', '~> 0.18.3'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'therubyracer', platforms: :ruby
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
gem 'execjs'
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
然后如果我运行gem query --local
我得到pg (0.18.3)
config / database.yml :
login: &login
adapter: postgresql
username: myuser
password: mypass
host: localhost
encoding: UTF8
development:
<<: *login
database: mydb_dev
test:
<<: *login
database: mydb_test
production:
<<: *login
database: mydb_prod
rvm信息:
ruby:
interpreter: "ruby"
version: "2.2.1p85"
date: "2015-02-26"
platform: "x86_64-linux"
patchlevel: "2015-02-26 revision 49769"
full_version: "ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-linux]"
homes:
gem: "/usr/local/rvm/gems/ruby-2.2.1"
ruby: "/usr/local/rvm/rubies/ruby-2.2.1"
binaries:
ruby: "/usr/local/rvm/rubies/ruby-2.2.1/bin/ruby"
irb: "/usr/local/rvm/rubies/ruby-2.2.1/bin/irb"
gem: "/usr/local/rvm/rubies/ruby-2.2.1/bin/gem"
rake: "/usr/local/rvm/rubies/ruby-2.2.1/bin/rake"
environment:
PATH: "/usr/local/rvm/gems/ruby-2.2.1/bin:/usr/local/rvm/gems/ruby-2.2.1@global/bin:/usr/local/rvm/rubies/ruby-2.2.1/bin:/usr/local/rvm/bin:/root/.composer/vendor/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
GEM_HOME: "/usr/local/rvm/gems/ruby-2.2.1"
GEM_PATH: "/usr/local/rvm/gems/ruby-2.2.1:/usr/local/rvm/gems/ruby-2.2.1@global"
MY_RUBY_HOME: "/usr/local/rvm/rubies/ruby-2.2.1"
IRBRC: "/usr/local/rvm/rubies/ruby-2.2.1/.irbrc"
RUBYOPT: ""
尝试重新启动Nginx时,我做错什么了吗?
您似乎已经安装了gem,但是重新启动时,捆绑程序找不到它。
一些想法:
bundle exec gem list
以查看包中的实际内容,而不仅仅是本地安装的内容(这是您在gem query --local
看到的gem query --local
)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.