Trellis build-before hook fails

Hi guys,

I am having trouble with build-before hook.
When i run deploy script with the build-before hook, it fails and comes with this error:

Traceback (most recent call last):
  File "/tmp/ansible_dP8nwf/", line 248, in <module>
  File "/tmp/ansible_dP8nwf/", line 192, in main
OSError: [Errno 2] No such file or directory:

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: OSError: [Errno 2] No such file or directory: '/srv/www/'
fatal: []: FAILED! => {"changed": false, "module_stdout": "", "rc": 1}
        to retry, use: --limit @/home/vagrant/trellis/deploy.retry

i have tried to change theme name from sage to nw, which is the folder name, but without any success. And i am pretty sure that the file path is correct. Tried to ssh into my DO droplet and cd into the folder.

But, when i dont use build-before, it seems to work fine.

I am using Windows,
so i am using the commands inside the vagrant box.

What could the problem be?

These hooks are run on the deploying workstation, not on the server side.
Theme build is meant to be done on workstation with node and npm dependencies installed,
the resulting build artifacts are then transferred to target system separately to the theme source code.
Use path to theme folder relative to trellis folder on your workstation.

1 Like

Okay that makes sense.
But it still fails and cannot find the directory, even that its there…

E.g. in wordpress_sites.yml for a project:

    local_path: ../ # path targeting local Bedrock site directory (relative to Ansible root)

So when you are in the trellis main directory (where also the server.yml and reside) and then go up one directory, then you find the project folder and inside the site folder?
Your setup may be different.

Still no success :confused:
I will try to create a whole new project on Mac instead of Windows, seems like its a bit easier to work on mac.

Will report back :slight_smile:

Okay, so i created a whole new project with default settings and default names and it seems to work!
I must have screwed something somewhere. Not sure.

But thanks for helping me! Now it’s time to root :stuck_out_tongue: