2015-10-15 49 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

相關問題