I am getting some strange errors and I have been scratching my head for hours trying to figure out what's going wrong here.
On my VPS, if I try to run rails c production
I am getting the following message:
$ 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>'
The directory /home/dani/.rvm/gems/ruby-2.2.0/specifications/
exists and contains a bunch of .gemspec
files. However, /home/dani/.rvm/gems/ruby-2.2.0/specifications/bin/
does not exist.
That seems to be the first problem.
The second problem is that when trying to access my website, I am getting the following error in the Phusion Passenger (nginx) logs:
[ 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>'
This has been setup correctly, everything was working fine before I ran a bundle update
earlier this morning.
Here is my 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;
}
The output of bundle show rails
is /home/dani/.rvm/gems/ruby-2.2.0/gems/rails-4.2.0
. Oddly, the output of cat /home/dani/asia-gazette/.bundle/config
is No such file or directory
.
Could this be a permissions issue?
Again, this was all working fine for months until this morning.
Any tips?
Thanks!
After a day of bashing my head, turns out that this fixes the problem:
$ bundle install --deployment --without development test
I'm not sure if this is the correct fix, but it seems to have gotten my app to work again. I am using Bundler version 1.7.13.
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.