# Unable to change directory before execution: [Errno 2] No such file or directory: '/srv/www/site.com/releases/20220525144820/web/app/tth

**URL:** https://discourse.roots.io/t/unable-to-change-directory-before-execution-errno-2-no-such-file-or-directory-srv-www-site-com-releases-20220525144820-web-app-tth/23229
**Category:** trellis
**Tags:** deploys, sage10, trellis
**Created:** 2022-05-25T15:00:04Z
**Posts:** 9

## Post 1 by @Silverdez — 2022-05-25T15:00:05Z

Hello hello  
I am quite new to using trellis and sage so maybe I didn’t understand something, but I tried to find an answer to this  
I got this error every time I do a `trellis deploy production`

```
Unable to change directory before execution: [Errno 2] No such file or
directory: '/srv/www/sitename.com/releases/20220525144820/web/app/themes/sitename'
fatal: [XXX.XX.XX.XX]:
```

I am on trellis 1.14.0 and using digitalocean  
I tried to change the local\_path: …/site to local\_path: ./site and I got the same error but without the releases/00000number

```
Unable to change directory before execution: [Errno 2] No such file or
directory: b'./site/web/app/themes/sitename'
```

it’s weird and I have no clue what I can change or not I tried SSL true false cache true cache false nothing changed I can not pass this error :frowning:

thanks in advance

---

## Post 2 by @Silverdez — 2022-05-26T07:56:21Z

If it can be helpful to understand  
I managed to make a trellis provision prod and dev without any error I have just this error on the deploy which I guess blocking me to get my website on my droplet :frowning:

thank you

---

## Post 3 by @cheezman — 2022-05-26T09:00:57Z

Hmm I haven’t seen this issue before

1. Have you tried visiting the directory on your remote server?

2. Have you [configured build-before.yml](https://github.com/roots/trellis/blob/f1f8ff1c7d10dba602916aff4c04d0132c524da3/deploy-hooks/build-before.yml) to ensure the theme is being built on deploy?

3. Could you try deploying without the theme to see if the issue lies there, and isn’t something related to permissions maybe?

---

## Post 4 by @Silverdez — 2022-05-26T10:33:14Z

```
# Placeholder `deploy_build_before` hook for building theme assets on the
# host machine and then copying the files to the remote server
#
# ⚠️ This example assumes your theme is using Sage 10
# An example for themes built with Sage 8 can be found at: https://git.io/vdgUt
#
# Uncomment the lines below and replace `sage` with your theme folder
#
# ---
 - name: Install npm dependencies
   command: yarn
   delegate_to: localhost
   args:
     chdir: "{{ project_local_path }}/web/app/themes/sitename"

 - name: Install Composer dependencies
   command: composer install --no-ansi --no-dev --no-interaction --no-progress --optimize-autoloader --no-scripts --classmap-authoritative
   args:
     chdir: "{{ deploy_helper.new_release_path }}/web/app/themes/sitename"

 - name: Compile assets for production
   command: yarn build
   delegate_to: localhost
   args:
     chdir: "{{ project_local_path }}/web/app/themes/sitename"

 - name: Copy production assets
   synchronize:
     src: "{{ project_local_path }}/web/app/themes/sitename/public"
     dest: "{{ deploy_helper.new_release_path }}/web/app/themes/sitename"
     group: no
     owner: no
     rsync_opts: --chmod=Du=rwx,--chmod=Dg=rx,--chmod=Do=rx,--chmod=Fu=rw,--chmod=Fg=r,--chmod=Fo=r
```

it’s my build-before.yml I think it’s correct I change the sage to my sitename

How I can deploy without the theme? I never saw this command :slight_smile: I didn’t even know it was possible :smiley:

on the droplet or even on the vagrant I don’t have any releases/00000 and when I try `./site` it’s the good path I think but even there it doesn’t work

---

## Post 5 by @Silverdez — 2022-05-26T16:14:18Z

I managed to reach this part  
`/srv/www/sitename.com/releases/20220526160735` of this error  
`/srv/www/sitename.com/releases/20220526160735/web/app/themes/sitename` but after I don’t have `web` folder on my droplet

I have this

 ![Screenshot 2022-05-26 at 19.09.24](https://discourse.roots.io/uploads/default/original/2X/6/6b6d4f0d2d042edfb2fe46cd0e2f749704e14d9b.png)  
so a bit weird because it seems to be the theme folder itself

how is possible my `build-before.yml` seems correct at least I did what it’s inside trellis documentation

---

## Post 6 by @Silverdez — 2022-05-27T12:27:58Z

Where I can find the way to only install WP with my theme? because regardless of if I try to reinstall the droplet with ubuntu 18 or 20lts (on 20lts I got some error) but I manage to provision the production but when I try to deploy I still get this issue

```
Unable to change directory before execution: [Errno 2] No such file or
directory: '/srv/www/sitename.com/releases/20220527121444/web/app/themes
/sitename_theme'
fatal: [000.000.00.000]: FAILED! => {"changed": false, "cmd": ["composer", "install", "--no-ansi", "--no-dev", "--no-interaction", "--no-progress", "--optimize-autoloader", "--no-scripts", "--classmap-authoritative"], "delta": null, "end": null, "rc": null, "start": null, "stderr": "", "stderr_lines": [], "stdout": "", "stdout_lines": []}
```

just for info, the errors I got on the ubuntu 20lts is

```
'/usr/bin/apt-get -y -o "Dpkg::Options::=--force-confdef" -o
"Dpkg::Options::=--force-confold" install 'build-essential'' failed: E:
Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 1827
(apt-get)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is
another process using it?

E: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 1827
(apt-get)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is
another process using it?
failed: [000.000.00.00] (item=build-essential) => {"ansible_loop_var": "item", "cache_update_time": 1653648393, "cache_updated": false, "changed": false, "item": {"key": "build-essential", "value": "present"}, "rc": 100, "stderr_lines": ["E: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 1827 (apt-get)", "E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?"], "stdout": "", "stdout_lines": []}
```

so for this, I go into the droplet and install this built-essential / Ghostscript and a few others do we have maybe another Ubuntu distribution?

---

## Post 7 by @joshb — 2022-08-10T22:22:53Z

I am running into this same problem attempting to deploy to a newly created production droplet. I have my build-before.yml file setup correctly for my theme folder name.

```
Unable to change directory before execution: [Errno 2] No such file or
directory: '/srv/www/customers.project.build/releases/20220810221742/web
/app/themes/crm'
fatal: [client.project.com]: FAILED! => {"changed": false, "cmd": ["composer", "install", "--no-ansi", "--no-dev", "--no-interaction", "--no-progress", "--optimize-autoloader", "--no-scripts", "--classmap-authoritative"], "delta": null, "end": null, "rc": null, "start": null, "stderr": "", "stderr_lines": [], "stdout": "", "stdout_lines": []}
```

Unfortunately I am unable to find a solution to why this happening.

---

## Post 8 by @Silverdez — 2022-08-11T06:32:11Z

Yes I still have that issue whatever I tried even with the last update and a completely fresh new installation it’s very frustrating

It comes apparently from the composer installation part from the build before yml I think, because every time it’s stop here and inside the droplet I have the srv/www and the release part but nothing is created after that. the folder is empty  
If someone else has an idea? I asked for help from digitalocean I will let know if I got any feedback

---

## Post 9 by @Silverdez — 2022-08-11T18:34:15Z

![Screenshot 2022-08-11 at 21.24.12](https://discourse.roots.io/uploads/default/original/2X/9/903d303bae6c21c128c6e01cc9f99427e7af3b3e.png)  
I tried again to connect to the droplet and as you can see I don’t know why I do not have all the deployment entirely created  
I asked Digitalocean directly but no ideas from them, I tried to install wget and update apt package but wget was already installed and nothing changed after the update I even tried to install ansible inside the droplet nothing  
When I deploy production it created different releases number but every time is not fully created and now seriously I just want to give up but it’s pity. :sob:  
Are we the 2 only ones to have this issue? :smile:
