2015-02-09 43 views
2

我收到了一些奇怪的錯誤,我一直在摸索我的頭幾個小時試圖弄清楚這裏出了什麼問題。Rails 4:更新寶石後的乘客錯誤

在我的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客運收到以下錯誤(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

這可能是一個權限問題?

再說一次,直到今天早上這幾個月都可以正常工作。

任何提示?

謝謝!

+0

你如何部署?你在哪裏運行「軟件包更新」? – 2015-02-09 16:53:30

+0

我在Rails項目中運行了'bundle update'。我將使用我的nginx配置文件更新原始文章 – DaniG2k 2015-02-09 16:56:04

+0

您是否在VPS上運行過「bundle update」? – 2015-02-09 16:58:05

回答

3

撲我的頭一天之後,事實證明,這種解決問題:

$ bundle install --deployment --without development test 

我不知道這是否是正確的修復,但它似乎已經得到了我的應用程序重新工作。我正在使用捆綁版本1.7.13。