Empty plugin directories after composer install/update

I successfully cloned an existing project and ran trellis up. A local machine was provisioned successfully.

I noticed that my plugins were not inside the mu-plugins and plugins directory. So i ran composer install and composer installed all dependencies. No errors. But then, the plugins directories were still empty.

So why does composer show me that all dependencies are installed, but none of them were downloaded to the plugins directory?

That’s going to depend on what your dependencies are. Composer only knows about “plugins” because of these lines:

Those are saying “Hey Composer, if you download a package with the type wordpress-muplugin then put it in this directory called web/app/mu-plugins in a directory named for the package. If you find a package with the type wordpress-plugin…” etc. Otherwise, Composer installs everything to the vendor folder.

This probably isn’t an issue with Trellis–it’s more likely to be an issue with Bedrock.

Are you using Sage? Which composer.json file did you install? Can you show us the actual command you ran, and the actual output?

Thanks for your feedback.
I installed the project with trellis-cli, so sage is used.
When i’m running composer install -vvvv i get following output:

| => composer install -vvvv
Running 2.3.5 (2022-04-13 16:43:00) with PHP 7.4.29 on Darwin / 21.3.0
Reading ./composer.json (/Users/user/Projekte/naanu/website/site/composer.json)
Loading config file /Users/user/.composer/config.json
Loading config file /Users/user/.composer/auth.json
Loading config file ./composer.json (/Users/user/Projekte/naanu/website/site/composer.json)
Checked CA file /usr/local/etc/ca-certificates/cert.pem: valid
Executing command (/Users/user/Projekte/naanu/website/site): 'git' 'branch' '-a' '--no-color' '--no-abbrev' '-v'
Reading /Users/user/.composer/composer.json
Loading config file /Users/user/.composer/config.json
Loading config file /Users/user/.composer/auth.json
Loading config file /Users/user/.composer/composer.json (/Users/user/.composer/composer.json)
Loading config file /Users/user/.composer/auth.json
Reading /Users/user/.composer/auth.json
Reading /Users/user/Projekte/naanu/website/site/vendor/composer/installed.json
Skipped loading "composer/installers" as it is not in config.allow-plugins
Reading /Users/user/.composer/vendor/composer/installed.json
Loading plugin FFraenz\PrivateComposerInstaller\Plugin (from ffraenz/private-composer-installer)
Loading plugin Roots\Composer\WordPressCorePlugin (from roots/wordpress-core-installer)
Reading ./composer.lock (/Users/user/Projekte/naanu/website/site/composer.lock)
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Reading ./composer.lock (/Users/user/Projekte/naanu/website/site/composer.lock)
Built pool.
Generating rules
Resolving dependencies through SAT
Looking at all rules.

Dependency resolution completed in 0.000 seconds
Nothing to install, update or remove
Generating optimized autoload files
13 packages you are using are looking for funding.
Use the `composer fund` command to find out more!

My composer file in the /sites folder looks like this:

{
  "name": "roots/bedrock",
  "type": "project",
  "license": "MIT",
  "description": "WordPress boilerplate with modern development tools, easier configuration, and an improved folder structure",
  "homepage": "https://roots.io/bedrock/",
  "authors": [
    {
      "name": "Scott Walkinshaw",
      "email": "scott.walkinshaw@gmail.com",
      "homepage": "https://github.com/swalkinshaw"
    },
    {
      "name": "Ben Word",
      "email": "ben@benword.com",
      "homepage": "https://github.com/retlehs"
    }
  ],
  "keywords": [
    "bedrock", "composer", "roots", "wordpress", "wp", "wp-config"
  ],
  "support": {
    "issues": "https://github.com/roots/bedrock/issues",
    "forum": "https://discourse.roots.io/category/bedrock"
  },
  "repositories": [
    {
      "type": "composer",
      "url": "https://wpackagist.org",
      "only": ["wpackagist-plugin/*", "wpackagist-theme/*"]
    },
    {
      "type": "package",
      "package": {
        "name": "advanced-custom-fields/advanced-custom-fields-pro",
        "version": "5.9.4",
        "type": "wordpress-muplugin",
        "dist": {
          "type": "zip",
          "url": "https://connect.advancedcustomfields.com/index.php?a=download&p=pro&k=b3JkZXJfaWQ9MTEwMTUyfHR5cGU9ZGV2ZWxvcGVyfGRhdGU9MjAxNy0wNy0xMSAxODo0NzozOA=="
        },
        "require": {
          "composer/installers": "^1.4",
          "ffraenz/private-composer-installer": "^5.0"
        }
      }
    },
    {
      "type": "vcs",
      "url": "git@github.com:user/naanu-website-theme-functions.git"
    },
    {
      "type": "vcs",
      "url": "git@github.com:user/menu-to-pdf.git"
    },
    {
      "type": "vcs",
      "url": "git@github.com:user/naanu-polylang-pro.git"
    },
    {
      "type": "vcs",
      "url": "git@github.com:user/saferpay-gateway-naanu.git"
    },
    {
      "type": "vcs",
      "url": "git@github.com:user/woocommerce-tipping.git"
    }
  ],
  "require": {
    "php": ">=7.1",
    "composer/installers": "^1.8",
    "vlucas/phpdotenv": "^4.1.8",
    "oscarotero/env": "^2.1",
    "roots/bedrock-autoloader": "^1.0",
    "roots/wordpress": "^5.5.3",
    "roots/wp-config": "^1.0.0",
    "roots/wp-password-bcrypt": "^1.0.0",
    "advanced-custom-fields/advanced-custom-fields-pro": "^5.9.0",
    "wpackagist-plugin/acf-extended": "^0.8.7",
    "wpackagist-plugin/wordpress-seo": "^16.0.0",
    "user/naanu-website-theme-functions": "^1.11.0",
    "wpackagist-plugin/acf-quickedit-fields": "^3.1",
    "wpackagist-plugin/scheduled-post-trigger": "^3.0",
    "wpackagist-plugin/simple-custom-post-order": "^2.5",
    "wpackagist-plugin/contact-form-7-honeypot":"^2.1",
    "wpackagist-plugin/filebird": "^4.0.0",
    "wpackagist-plugin/theme-translation-for-polylang": "^3.2",
    "user/naanu-polylang-pro": "dev-main",
    "user/saferpay-gateway-naanu": "^1.0",
    "wpackagist-plugin/mailpoet": "^3.59.0",
    "wpackagist-plugin/contact-form-7": "^5.4",
    "user/woocommerce-tipping": "^1.2",
    "wpackagist-plugin/akismet": "^4.1.10",
    "wpackagist-plugin/woocommerce": "^5.5",
    "wpackagist-plugin/log-deprecated-notices":"^0.4.1",
    "wpackagist-plugin/login-ip-country-restriction": "^6.2.2",
    "user/menu-to-pdf": "^1.0"
  },
  "require-dev": {
    "squizlabs/php_codesniffer": "^3.5.6",
    "roave/security-advisories": "dev-master"
  },
  "config": {
    "optimize-autoloader": true,
    "preferred-install": "dist",
    "allow-plugins": {
      "composer/installers": false,
      "ffraenz/private-composer-installer": true,
      "roots/wordpress-core-installer": true
    }
  },
  "minimum-stability": "dev",
  "prefer-stable": true,
  "extra": {
    "installer-paths": {
      "web/app/mu-plugins/{$name}/": ["type:wordpress-muplugin"],
      "web/app/plugins/{$name}/": ["type:wordpress-plugin"],
      "web/app/themes/{$name}/": ["type:wordpress-theme"]
    },
    "wordpress-install-dir": "web/wp"
  },
  "scripts": {
    "post-root-package-install": [
      "php -r \"copy('.env.example', '.env');\""
    ],
    "test": [
      "phpcs"
    ]
  }
}

Why did you change this to false? So far as I know, composer/installers is what allows Composer packages to be installed in locations other than vendor. Default Bedrock sets this as true.

1 Like

You’re so right! No idea who changed this.
Thanks a lot for your code review :heart:

1 Like