1

I run into a weird issue with capistrano 3 and brunch. I want to execute brunch on remote server but nothing happen. My custom remote task looks like this:

namespace :brunch do
    desc "Building assets with brunch.io"
    task :build do
        on roles(:web) do
            within "#{release_path}" do
                execute "node #{release_path}/node_modules/brunch/bin/brunch build --env=#{fetch(:stage)} #{release_path}"
            end
        end
    end
end

When I run "cap staging deploy", I can see command is executed:

INFO [a246858c] Running node /releases/20160303145521/node_modules/brunch/bin/brunch build --env=staging /releases/20160303145521 as web
INFO [a246858c] Finished in 0.159 seconds with exit status 0 (successful).

But my assets are not built, nothing is done. And if I connect on my server run command, everything works fine.

I don't understand this behaviour, is any one aware of that?

Thanks a lot for your help

I'm using Capistrano Version: 3.4.0 (Rake Version: 10.5.0)

  • Does brunch have a flag which dumps debugging output when it runs? Can you add that flag and run the deployment? The command is running and exiting with a success exit code, so I don't know what it is supposed to be doing. – will_in_wi Mar 03 '16 at 15:35
  • Hello will_in_wi and many thanks for your answer. I apologize because I wasn't aware of your answer. It's fixed now. The problem relied on nvm and node. On my server, I'm using nvm and when I'm logging in, .bashrc file is sourced, so environement paths are well known. But when I'm using capistrano and SSHkit, .bashrc file is not sourced and brunch fail to build assets. I modify my code to source nvm file: execute "source ~/.nvm/nvm.sh && node #{release_path}/node_modules/brunch/bin/brunch build --env=#{fetch(:stage)} #{release_path}" All is good now – Franck Magnan Mar 08 '16 at 10:24

0 Answers0