我尝试使用capistrano-node-deploy部署我的node.js应用。运行cap deploy
时出现以下错误:
$ cap deploy
/usr/lib/ruby/vendor_ruby/capistrano/configuration/loading.rb:152:in `require': no such file to load -- capistrano/node-deploy (LoadError)
from /usr/lib/ruby/vendor_ruby/capistrano/configuration/loading.rb:152:in `require'
from Capfile:1:in `load'
from /usr/lib/ruby/vendor_ruby/capistrano/configuration/loading.rb:172:in `load_from_file'
from /usr/lib/ruby/vendor_ruby/capistrano/configuration/loading.rb:89:in `load'
from /usr/lib/ruby/vendor_ruby/capistrano/configuration/loading.rb:86:in `load'
from /usr/lib/ruby/vendor_ruby/capistrano/configuration/loading.rb:86:in `each'
from /usr/lib/ruby/vendor_ruby/capistrano/configuration/loading.rb:86:in `load'
from /usr/lib/ruby/vendor_ruby/capistrano/cli/execute.rb:65:in `load_recipes'
from /usr/lib/ruby/vendor_ruby/capistrano/cli/execute.rb:65:in `each'
from /usr/lib/ruby/vendor_ruby/capistrano/cli/execute.rb:65:in `load_recipes'
from /usr/lib/ruby/vendor_ruby/capistrano/cli/execute.rb:31:in `execute!'
from /usr/lib/ruby/vendor_ruby/capistrano/cli/execute.rb:14:in `execute'
from /usr/bin/cap:4
我的Gemfile
看起来像这样
source 'https://rubygems.org'
gem 'capistrano', '~> 2.15.5'
gem 'capistrano-node-deploy', '~> 1.2.11'
gem 'capistrano_rsync_with_remote_cache', '~> 2.4.0'
gem 'capistrano-shared_file', '~> 0.1.3'
然后我做了bundle install
似乎是成功的:
$ bundle install
Using highline (1.6.20)
Using net-ssh (2.7.0)
Using net-scp (1.1.2)
Using net-sftp (2.1.2)
Using net-ssh-gateway (1.2.0)
Using capistrano (2.15.5)
Using multi_json (1.3.7)
Using railsless-deploy (1.1.2)
Using capistrano-node-deploy (1.2.11)
Using capistrano-shared_file (0.1.3)
Using capistrano_rsync_with_remote_cache (2.4.0)
Using bundler (1.3.5)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
然后,我根据this blog post
创建了一个Capfile
require "capistrano/node-deploy"
require "capistrano/shared_file"
set :application, "tff"
set :user, "ubuntu"
set :deploy_to, "/home/ubuntu/www/tff"
set :node_user, "ubuntu"
set :node_env, "production"
set :scm, :git
set :repository, "/home/ubuntu/tff/tff.git"
set :deploy_via, :rsync_with_remote_cache
role :app, "example.org"
set :shared_files, ["config.js"]
set :shared_children, ["content/data", "content/images"]
set :keep_releases, 5
namespace :deploy do
task :mkdir_shared do
run "cd #{shared_path} && mkdir -p data images files"
end
end
after "deploy:create_symlink", "deploy:mkdir_shared"
即使是更基本的设置也会导致同样的错误,即无法require "capistrano/node-deploy"
。有什么想法吗?
答案 0 :(得分:0)
尝试:
echo $ GEM_PATH
如果为空,请尝试:
sudo find / -type d -name capistrano-node-deploy *
返回:
/var/lib/gems/1.8/gems/capistrano-node-deploy-1.2.11
echo“export GEM_PATH = / var / lib / gems / 1.8 / gems /”>>的〜/ .bashrc
source~ / .bashrc
echo $ GEM_PATH
返回:/var/lib/gems/1.8/gems /