我遇到了一些奇怪的错误,我一直在摸索我的头几个小时试图找出这里出了什么问题。
在我的VPS上,如果我尝试运行rails c production
我收到以下消息:
$ rails c production /home/dani/.rvm/gems/ruby-2.2.0/bin/rails:23:in `load': cannot load such file -- /home/dani/.rvm/gems/ruby-2.2.0/specifications/bin/rails (LoadError) from /home/dani/.rvm/gems/ruby-2.2.0/bin/rails:23:in `<main>' from /home/dani/.rvm/gems/ruby-2.2.0/bin/ruby_executable_hooks:15:in `eval' from /home/dani/.rvm/gems/ruby-2.2.0/bin/ruby_executable_hooks:15:in `<main>'
目录/home/dani/.rvm/gems/ruby-2.2.0/specifications/
存在,并包含一堆.gemspec
文件。 但是,/ /home/dani/.rvm/gems/ruby-2.2.0/specifications/bin/
不存在。
这似乎是第一个问题。
第二个问题是,当试图访问我的网站时,我在Phusion Passenger(nginx)日志中得到以下错误:
[ 2015-02-09 16:43:59.1936 6175/7f34723ac700 agents/HelperAgent/RequestHandler.h:2306 ]: [Client 20] Cannot checkout session because a spawning error occurred. The identifier of the error is 576137e4. Please see earlier logs for details about the error. App 29360 stdout: App 29360 stdout: [ 2015-02-09 16:44:49.0985 6175/7f3474514700 Pool2/Implementation.cpp:287 ]: Could not spawn process for application /home/dani/asia-gazette: An error occured while starting up the preloader. Error ID: c29b4e0c Error details saved to: /tmp/passenger-error-qH99US.html Message from application: cannot load such file -- rails/all (LoadError) /home/dani/asia-gazette/config/application.rb:3:in `require' /home/dani/asia-gazette/config/application.rb:3:in `<top (required)>' /home/dani/asia-gazette/config/environment.rb:2:in `require' /home/dani/asia-gazette/config/environment.rb:2:in `<top (required)>' config.ru:3:in `require' config.ru:3:in `block in <main>' /home/dani/.rvm/gems/ruby-2.2.0/gems/rack-1.6.0/lib/rack/builder.rb:55:in `instance_eval' /home/dani/.rvm/gems/ruby-2.2.0/gems/rack-1.6.0/lib/rack/builder.rb:55:in `initialize' config.ru:1:in `new' config.ru:1:in `<main>' /home/dani/.rvm/gems/ruby-2.2.0/gems/passenger-4.0.58/helper-scripts/rack-preloader.rb:112:in `eval' /home/dani/.rvm/gems/ruby-2.2.0/gems/passenger-4.0.58/helper-scripts/rack-preloader.rb:112:in `preload_app' /home/dani/.rvm/gems/ruby-2.2.0/gems/passenger-4.0.58/helper-scripts/rack-preloader.rb:158:in `<module:App>' /home/dani/.rvm/gems/ruby-2.2.0/gems/passenger-4.0.58/helper-scripts/rack-preloader.rb:29:in `<module:PhusionPassenger>' /home/dani/.rvm/gems/ruby-2.2.0/gems/passenger-4.0.58/helper-scripts/rack-preloader.rb:28:in `<main>'
这已被正确设置,一切正常工作之前,我今天早上跑了一个bundle update
。
这是我的nginx.conf :
user www-data; worker_processes 1; error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } http { passenger_root /home/dani/.rvm/gems/ruby-2.2.0/gems/passenger-4.0.58; passenger_ruby /home/dani/.rvm/gems/ruby-2.2.0/wrappers/ruby; #passenger_debugger on; #passenger_log_level 3; #passenger_debug_log_file /home/dani/passenger_errors.log; #server_names_hash_bucket_size 64; include upstream.conf; include mime.types; default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; # Catch non-matching server names. server { return 404; } include /etc/nginx/sites-enabled/*.conf; }
bundle show rails
的输出是/home/dani/.rvm/gems/ruby-2.2.0/gems/rails-4.2.0
。 奇怪的是, cat /home/dani/asia-gazette/.bundle/config
的输出是No such file or directory
。
这可能是一个权限问题?
再次,直到今天上午,这一切都运行良好。
有小费吗?
谢谢!
经过一天的抨击我的头,原来这解决了这个问题:
$ bundle install --deployment --without development test
我不确定这是否是正确的解决方法,但它似乎已经得到我的应用程序再次工作。 我正在使用捆绑版本1.7.13。