Composer not installing web/core or web/modules/contrib in Drupal project
Asked by Chris Thorp:

This bitbucket-pipelines.yml file has worked for year, but has suddenly broken with no changes. composer install works perfectly on local machine, and on server, just not in pipeline. Has something changed?

'web/core' 'web/modules/contrib' not created, although 'vendor' is, how can I fix this?

Logs from the pipeline:

Searching for files matching artifact pattern vendor/**  
Artifact pattern vendor/** matched 30513 files with a total size of 131.4 MiB  
Compressed files matching artifact pattern vendor/** to 38.1 MiB in 13 seconds  
Uploading artifact of 38.1 MiB  
Successfully uploaded artifact in 2 seconds  
Searching for files matching artifact pattern web/core/**  
Searching for files matching artifact pattern web/modules/contrib/**  
Searching for files matching artifact pattern web/themes/rhm_starter/css/build/**  
Artifact pattern web/themes/rhm_starter/css/build/** matched 1 files with a total size of 3.2 MiB  
Compressed files matching artifact pattern web/themes/rhm_starter/css/build/** to 513.5 KiB in 1 seconds  
Uploading artifact of 513.5 KiB  
Successfully uploaded artifact in 0 seconds

```
# This is a sample build configuration for PHP.
# Check our guides at https://confluence.atlassian.com/x/e8YWN for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: drupal:8

definitions:
  caches:
    node-custom: web/themes/me/node_modules
  steps:
    - step: &Build-step
        name: Build
        caches:
          - composer
          - node
          - node-custom
        script:
          - apt-get update && apt-get install -y unzip
          - apt-get install -y unzip git
          - apt-get install -y libxml2-dev php-soap && apt-get clean -y && docker-php-ext-install soap
          - curl -sL https://deb.nodesource.com/setup_12.x | bash -
          - curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
          - apt-get install -y nodejs
          - npm install -g gulp
          - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
          - composer install --ignore-platform-reqs
          - cd web/themes/me/.gulp
          - npm install
          - gulp buildStyles
          - gulp buildScriptsMin
        artifacts:
          - vendor/**
          - web/core/**
          - web/modules/contrib/**
          - web/themes/me/css/build/**
          - web/themes/me/js/build/**
    - step: &Deploy-step
        name: Deploy
        script:
          - pipe: atlassian/rsync-deploy:0.4.3
            variables:
              USER: $USER
              SERVER: $SERVER
              REMOTE_PATH: $REMOTE_PATH
              LOCAL_PATH: '.'
              EXTRA_ARGS: '--exclude-from=deployment-exclude-list.txt'
          - pipe: atlassian/ssh-run:0.2.6
            variables:
              SSH_USER: $USER
              SERVER: $SERVER
              COMMAND: "cd $REMOTE_PATH/web && export PATH=/RunCloud/Packages/php81rc/bin:$PATH:$HOME/bin && ../vendor/drush/drush/drush cr && ../vendor/drush/drush/drush updb -y && ../vendor/drush/drush/drush cim -y"

pipelines:
  branches:
    development:
      - step: *Build-step
      - step:
          <<: *Deploy-step
          deployment: test
    staging:
      - step: *Build-step
      - step:
          <<: *Deploy-step
          deployment: staging
    master:
      - step: *Build-step
      - step:
          trigger: manual
          <<: *Deploy-step
          deployment: production
```

composer.json:  

```
{
    "name": "drupal-composer/drupal-project",
    "description": "Project template for Drupal 8 projects with composer",
    "type": "project",
    "license": "GPL-2.0-or-later",
    "authors": [
        {
            "name": "",
            "role": ""
        }
    ],
    "repositories": [
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        }
    ],
    "require": {
        "ext-json": "*",
        "composer/installers": "^1",
        "cweagans/composer-patches": "^1.6.5",
        "drupal/admin_toolbar": "^3",
        "drupal/advagg": "^5",
        "drupal/amswap": "^3",
        "drupal/anonymous_login": "^2",
        "drupal/better_exposed_filters": "^6",
        "drupal/captcha": "1.x-dev",
        "drupal/console": "~1.0",
        "drupal/copyright_block": "^2",
        "drupal/core-composer-scaffold": "^9",
        "drupal/core-recommended": "^9",
        "drupal/date_popup": "^1.0",
        "drupal/devel": "^5",
        "drupal/devel_php": "^1.1",
        "drupal/disable_language": "^1.0",
        "drupal/eck": "^1.0@alpha",
        "drupal/entity_browser": "^2.2",
        "drupal/field_encrypt": "^2",
        "drupal/field_group": "^3",
        "drupal/google_analytics": "^4.0",
        "drupal/mailchimp": "^2",
        "drupal/menu_item_extras": "^2.4",
        "drupal/metatag": "^1.8",
        "drupal/mimemail": "^1.0@alpha",
        "drupal/paragraphs": "^1.7",
        "drupal/partial": "^1.1",
        "drupal/pathauto": "^1.3",
        "drupal/prepopulate": "^2.2",
        "drupal/quick_node_clone": "^1.12",
        "drupal/rabbit_hole": "^1.0@beta",
        "drupal/real_aes": "^2.2",
        "drupal/recaptcha": "^3",
        "drupal/recreate_block_content": "^3",
        "drupal/reroute_email": "^2",
        "drupal/rules": "3.x-dev@dev",
        "drupal/site_settings": "^1.13",
        "drupal/stage_file_proxy": "^2",
        "drupal/stripe": "^1.0@beta",
        "drupal/swiftmailer": "^2",
        "drupal/time_range": "^9",
        "drupal/twig_extensions": "2.x-dev@dev",
        "drupal/twig_tweak": "^3",
        "drupal/ultimate_cron": "^2.0@alpha",
        "drupal/verf": "^2",
        "drupal/views_conditional": "^1.0",
        "drupal/views_data_export": "^1.0@beta",
        "drupal/xmlsitemap": "^1.0@alpha",
        "drupal/youtube": "^2",
        "drush/drush": "^10",
        "vlucas/phpdotenv": "^2.4",
        "webflo/drupal-finder": "^1.0.0",
        "webmozart/path-util": "^2.3"
    },
    "require-dev": {
        "drupal/twig_xdebug": "^1.0"
    },
    "conflict": {
        "drupal/drupal": "*"
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "config": {
        "sort-packages": true,
        "allow-plugins": {
            "cweagans/composer-patches": true,
            "composer/installers": true,
            "drupal/core-composer-scaffold": true,
            "drupal/console-extend-plugin": true
        }
    },
    "autoload": {
        "classmap": [
            "scripts/composer/ScriptHandler.php"
        ],
        "files": [
            "load.environment.php"
        ]
    },
    "scripts": {
        "pre-install-cmd": [
            "DrupalProject\\composer\\ScriptHandler::checkComposerVersion"
        ],
        "pre-update-cmd": [
            "DrupalProject\\composer\\ScriptHandler::checkComposerVersion"
        ],
        "post-install-cmd": [
            "DrupalProject\\composer\\ScriptHandler::createRequiredFiles"
        ],
        "post-update-cmd": [
            "DrupalProject\\composer\\ScriptHandler::createRequiredFiles"
        ]
    },
    "extra": {
        "patchLevel": {
            "drupal/core": "-p2"
        },
        "installer-paths": {
            "web/core": [
                "type:drupal-core"
            ],
            "web/libraries/{$name}": [
                "type:drupal-library"
            ],
            "web/modules/contrib/{$name}": [
                "type:drupal-module"
            ],
            "web/profiles/contrib/{$name}": [
                "type:drupal-profile"
            ],
            "web/themes/contrib/{$name}": [
                "type:drupal-theme"
            ],
            "drush/Commands/{$name}": [
                "type:drupal-drush"
            ]
        },
        "drupal-scaffold": {
            "locations": {
                "web-root": "web/"
            }
        },
        "patches": {
            "drupal/copyright_block": {
                "Fix core version": "https://www.drupal.org/files/issues/2023-05-08/copyright_block-fix-core-version-3357937.patch"
            }
        }
    }
}
```


Answers:
author: Chris Thorp
body: This fixed it at the start of the build script:

- export COMPOSER_ALLOW_SUPERUSER=1


Tags: bitbucket-pipelines

cloud