Roots Discourse

Composer update error - site down :(


#1

I would like to update the plugin so I run Composer on the Vagrant box.

From my Trellis directory i run:
vagrant ssh
cd /srv/www//current
composer update

I received this error in the console

and when I tried to see the local website I see this :sob::sob::sob:

unfortunately, we need to go live tomorrow, is there a quick fix for this?

my composer file is this one:

i am sorry for this panic post, but as I said we are supposed to go live tomorrow :sob:

any help would be super helpful :pray:


#2

A quick search for the error and you can see others with a similar issue. I know the versions are different but try the solutions there as they should be what you need.


#3

Shouldn’t trellis check for HTTP 200 before permanently switching the current symlink to the new release?


#4

Trellis does ensure composer install successful before symlink during deploy (i.e.: $ ./bin/deploy.sh).
However, running composer install directly inside vagrant VM does not. because ansible is not being invoked.


#5

i followed this solution

so I ran: ANSIBLE_TAGS=composer vagrant provision from my trellis local directory.

but I have still have the same errors:

( ! ) Fatal error: Uncaught Error: Class 'Dotenv\Dotenv' not found in /srv/www/domain.co.uk/current/config/application.php on line  *17*

( ! ) Error: Class 'Dotenv\Dotenv' not found in /srv/www/domain.co.uk/current/config/application.php on line  *17*

am I missing something?

what else I can try to do?


#6

i tried also to remove the vendor directory from /site/ and running composer update again.

  1. From my Trellis directory: vagrant ssh
  2. cd /srv/www/<sitename>/current
  3. composer update

but i get a new error

  [RuntimeException]
  Could not delete web/wp/wp-admin/css/about-rtl.css:

:sob:

any suggestion would be great :pray:


#7

You could try deleting the web/wp directory manually. Composer should reinstall it.


#8

thanks @MWDelaney for your reply, i tried also remove web/wp directory manually.

now the problem is ACF plugin, can I remove also this manually or I will lose something?

basically, I can remove all the directories manually, until the composer install will finish with a success message, or there is something that it is better to don’t delete manually?

looking at the console output, I am wondering if there is a problem with the cache.
is it normal that composer install these packages loading from cache?

many thanks


#9

Obviously don’t delete any plugins or packages you maintain manually, but if all your plugins are managed with composer I say just blow away everything in vendor and plugins, run composer clear-cache and try composer install again.


#10

@MWDelaney you are my hero :pray:
i finally have my development site working again, thanks for your suggestions, very helpful.

looking at the git unstaged files, the only thing that I changed is a line in the requirements.yml file in the trellis directory. (found this solution here)

54

Should I do the re-provision of the staging/production after this update?

For future reference, if anybody will run into the same problem, these are the steps. (thanks to @MWDelaney)

  1. For development , run this: ANSIBLE_TAGS=composer vagrant provision (see this topic)
  2. Manually delete the vendor folder, the web/wp and the plugins that you manage with composer
  3. From my Trellis directory: vagrant ssh
  4. cd /srv/www/<sitename>/current
  5. composer clear-cache
  6. composer update