Plugins missing on staging after deploy

I have the plugin Password Protected installed correctly on my staging and on my composer.json file.

“require”: {
“php”: “>=7.1”,
“composer/installers”: “^1.7”,
“vlucas/phpdotenv”: “^3.4.0”,
“oscarotero/env”: “^1.2.0”,
“roots/wordpress”: “5.2.3”,
“roots/wp-config”: “1.0.0”,
“roots/wp-password-bcrypt”: “1.0.0”,
“wpackagist-plugin/password-protected”: “^2.2”

unfortunaltely I noticed that everytime that I deploy to the staging, the plugin is not there, if i check the wp-admin, i can see this message “The plugin password-protected/password-protected.php has been deactivated due to an error: Plugin file does not exist.”
if I run composer update on the staging, I can see the plugin in the admin area, but i need active it and re-configure the settings.

my default deploy-hooks seems ok, I followed what I usually do with the trellis/bedrock projects, I always use the “Password Protected” plugin to protect my staging website, but I don’t know why this time I have this problem.

Am I missing something?

I noticed that it is doing the same thing with another plugin (ACF Pro).
I followed this guide >

but it seems that every time that I deploy, it remove the plugins installed on my staging, so I need to re-run composer update on staging, but then I need to active and re-set up the plugin settings.

I am pretty sure that I am missing a step, do you have any idea?

When you use composer packages there’s two files composer reads composer.json and composer.lock.

A composer.lock file stores exact versions of dependancies. This is always read first by a composer install command - which is the same command executed on a deploy to staging / production.

When you run a composer update it reads from the composer.json and generates a new composer.lock file.

The .lock file acts as a screenshot of dependancies, allowing your environments to have a consistent dependancy list. Or allowing everyone using this codebase to have matching dependancies.

See how composer works here: This is also similar to how yarn and npm work with package.json and package.lock / yarn.lock.

To fix your issue:

  • Run composer update locally, this will generate a new composer.lock file
  • Commit your composer.json and composer.lock files to your repository
  • Deploy to staging

thanks @craigpearson it works, now it is clear, I noted this step for the next time.
thanks a lot :wink:

This topic was automatically closed after 42 days. New replies are no longer allowed.