2015-10-15 56 views
1

我正在尝试使用Capistrano使用以下this教程部署角应用程序。所以在我的Capfile我有以下几点:如何使用Capistrano部署角应用程序

require 'capistrano/setup' 
require 'capistrano/deploy' 
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r } 

在我config/deploy文件我有以下几点:

... 
task :bower_and_npm_install do 
    on roles(:app), in: :sequence, wait: 5 do 
    within release_path do 
     execute :npm, "install" 
     execute :bower, "install" 
    end 
    end 
end 
after :published, :bower_and_npm_install 
... 

当我尝试部署我得到以下错误:

[6ff53bb3] Command: cd /home/user/apps/myapp/releases/20151015095546 && /usr/bin/env npm install 
DEBUG [6ff53bb3] /usr/bin/env: 
DEBUG [6ff53bb3] npm 
DEBUG [6ff53bb3] : No such file or directory 

我已经试过如下:

... 
execute "bash -c '. /usr/bin/npm && cd #{current_path} && npm install'" 
... 
OR 
execute "/usr/bin/npm && cd #{current_path} && npm install'" 
OR 
execute "cd #{current_path} && npm install'" 

它没有工作。

任何想法?

回答

1

这意味着NPM未安装在服务器上,或者不在部署用户的路径中。

如果你ssh进入服务器并运行npm --version,它会返回什么?

你可能想尝试https://github.com/capistrano/npm/

+0

它返回南版本。当我运行'which npm'时,我得到'/ usr/bin/npm'我得不到的是为什么Capistrano正在'/ usr/bin/env'上寻找节点 – WagnerMatosUK

+0

env的原因在这里解释:http: //capistranorb.com/documentation/faq/why-does-something-work-in-my-ssh-session-but-not-in-capistrano/ –

+0

嗨请问。感谢您的回复。我之前看过那篇文章。它确实解释了原因,但没有解决问题。我拥有capistrano/node,但我相信这个模块已经过时了,它也不能工作 – WagnerMatosUK

相关问题