Trellis up fails, Composer could not find a composer.json file

Hi,

I am trying to setup Trellis with Bedrock and Sage. I can run the new project command which creates my project with Trellis and Site (Bedrock) directories. My first question is at this point do I need to change into the sites directory and run “composer install” to install fully install Bedrock WordPress?

When I run the trellis up command I am receiving the “Composer could not find a composer.json file in /srv/www/example.com/current” error and the process fails. I did setup this project with the example.com as I am learning how to successfully run this process. It seems nothing is being placed in the “current” directory for Bedrock to be installed in the local development environment. My second question is, am I missing a step that I need to execute prior to running trellis up?

After the first run through with trellis up and the process failing at the [wordpress-install : Install Dependencies with Composer] due to a missing composer.json file I went into the site folder and ran the composer install command to install WordPress and other dependencies. I then ran the process to re-provision the development environment but ended up at the same place with the process failing at the [wordpress-install : Install Dependencies with Composer] due to a missing composer.json file.

What setups need to be completed between Trellis New Example.com and Trellis Up?

My first question is at this point do I need to change into the sites directory and run “composer install” to install fully install Bedrock WordPress?

No, that is done during the provisioning process

Composer could not find a composer.json file

I think this error usually comes from running Trellis on a folder/hard drive that is encrypted (see the big note at https://roots.io/trellis/docs/local-development/#vagrant)

What operating system are you using? If on macOS, you could be hitting this

Thank you for the prompt reply!

I am running macOS Sonoma and the drives are not encrypted.

I have updated the permissions for the nfsd file on my system and then ran trellis provision development because running trellis up boots the VM but doesn’t seem to run back through the development environment playbook.

The process failed at the same spot, [wordpress-install : Install Dependencies with Composer].

If you change directories to site and run composer install from there what happens? Is composer working on your Mac?

Yes, Composer is running on my Mac and switching back to the site directory and running composer install worked just fine.

After doing that I re-provisioned the development environment but failed at the install-wordpress dependencies with composer task again.

Just to confirm, are you using Trellis CLI to create your site? trellis new example.com?

Yes, I created the project with Trellis CLI, trellis new example.com.

This feels like a permissions issue. You’ve rebooted since fixing nfsd?

Is there anything unusual about the path to your site files? Are you on an external drive? Anything like that?

I have not rebooted since updating permissions for nfsd.

I’m looking at another forum post (NFS problem on macOS Sonoma - #6 by Twansparant) which reminded me that the very first time I ran trellis up today the process failed because the only references in the export file are to an older VM and it couldn’t update the file.

I just deleted the current VM from Parallels and ran Trellis Up again and now I received this error message:

Could not kickstart service “com.apple.nfsd”: 1: Operation not permitted
/bin/launchctl exited with status 1
==> default: Mounting NFS shared folders…
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
mount -o vers=3 10.211.55.2:/Users/apompei/Sites/example.com/site /vagrant-nfs-example.com
Stdout from the command:
Stderr from the command:
mount.nfs: an incorrect mount option was specified
exit status 1

There seems to be a permission issue there however I am not sure what is trellis trying to do here.

1 Like

@MWDelaney - I don’t there is anything unusual with the path to the site files, I didn’t make any customizations. Yes, the files are on my primary drive. I recall an issue from past macOS upgrade where sites couldn’t be run from external drives any longer.

This comment fixed it for me!

I ran sudo nfsd update, restarted my system and ran trellis up again. I’m back to the process failing at [wordpress-install : Install Dependencies with Composer] but it didn’t exit directly afterward. There’s this output

RUNNING HANDLER [common : restart memcached] ***********************************
changed: [default]

RUNNING HANDLER [common : reload php-fpm] **************************************
changed: [default]

RUNNING HANDLER [common : restart journald] ************************************
changed: [default]

RUNNING HANDLER [common : reload nginx] ****************************************
changed: [default]

RUNNING HANDLER [common : perform nginx reload] ********************************
changed: [default]

RUNNING HANDLER [fail2ban : restart fail2ban] **********************************
changed: [default]

RUNNING HANDLER [ferm : restart ferm] ******************************************
skipping: [default]

RUNNING HANDLER [ntp : restart ntp] ********************************************
changed: [default]

RUNNING HANDLER [ntp : restart cron] *******************************************
skipping: [default]

RUNNING HANDLER [sshd : restart ssh] *******************************************
changed: [default]

RUNNING HANDLER [mariadb : restart mysql server] *******************************
changed: [default]

Thank you @Twansparant. I am trying that update now.

Ok, I just accomplished a complete provision of the local development environment with Trellis. I updated the following system permissions on my macOS Sonoma MacBook:

  • Gave full disc access to the nfsd executable - referenced this Stack Overflow post - thank you @ben for the link
  • Updated the exports file by running sudo nfsd update - referenced here
  • then updated the vagrant.default.yml file - referenced here

Thank you @ben, MWDelaney, and @Twansparant for your prompt and on point responses. You are all awesome!

2 Likes