Skip to main content
3 of 3
removed "Drupal" and tags from the title
avpaderno
  • 97.9k
  • 15
  • 164
  • 284

Add Composer to an existing site

I built a Drupal 8.9 site with Composer on a DEV server and copied the files (& db) over to the LIVE server.

The LIVE server did not have Composer installed previously so I installed it, locally.

The new website has its composer.json file from when I created the site and added modules.

I tried composer update to verify that composer will work when the time comes.

It fails and I don't know if I need to rip out the website and re-create it again (then copy select files back over).


When I run it I get the following output:

Loading composer repositories with package information Updating dependencies Your requirements could not be resolved to an installable set of packages.

Problem 1
    
    - Conclusion: don't install drupal/core-recommended 8.9.x-dev (conflict analysis result)
    - Conclusion: don't install drupal/core-recommended 8.8.7 (conflict analysis result)
    - Conclusion: don't install drupal/core-recommended 8.8.8 (conflict analysis result)
    - Conclusion: don't install drupal/core-recommended 8.8.9 (conflict analysis result)
    - Conclusion: don't install drupal/core-recommended 8.8.10 (conflict analysis result)
    - Conclusion: don't install drupal/core-recommended 8.8.11 (conflict analysis result)
    - Conclusion: don't install drupal/core-recommended 8.8.12 (conflict analysis result)
    - Conclusion: don't install drupal/core-recommended 8.9.0 (conflict analysis result)
    - Conclusion: don't install drupal/core-recommended 8.9.1 (conflict analysis result)
    - Conclusion: don't install drupal/core-recommended 8.9.2 (conflict analysis result)
    - Conclusion: don't install drupal/core-recommended 8.9.3 (conflict analysis result)
    - Conclusion: don't install drupal/core-recommended 8.9.4 (conflict analysis result)
    - Conclusion: don't install drupal/core-recommended 8.9.5 (conflict analysis result)
    - Conclusion: don't install drupal/core-recommended 8.9.6 (conflict analysis result)
    - Conclusion: don't install drupal/core-recommended 8.9.7 (conflict analysis result)
    - Conclusion: don't install drupal/core-recommended 8.9.8 (conflict analysis result)
    - Conclusion: don't install drupal/core-recommended 8.9.9 (conflict analysis result)
    - Conclusion: don't install drupal/core-recommended 8.9.10 (conflict analysis result)
    - Conclusion: don't install drupal/core-recommended 8.9.11 (conflict analysis result)
    - Conclusion: don't install drupal/core-recommended 8.9.12 (conflict analysis result)
    - Conclusion: don't install drupal/core-recommended 8.9.13 (conflict analysis result)
    - Conclusion: don't install drupal/core-recommended 8.9.14 (conflict analysis result)
    - Conclusion: don't install drupal/core-recommended 8.9.15 (conflict analysis result)
    - Conclusion: don't install drupal/core-recommended 8.9.16 (conflict analysis result)
    - Conclusion: don't install drupal/core-recommended 8.9.17 (conflict analysis result)
    - Conclusion: don't install drupal/core-recommended 8.9.18 (conflict analysis result)
    - Conclusion: don't install drupal/core-recommended 8.9.19 (conflict analysis result)
    - Conclusion: don't install drupal/core-recommended 8.9.20 (conflict analysis result)
    - drupal/core-recommended[8.8.0-beta1, ..., 8.9.0-rc1] require composer/installers v1.7.0 -> satisfiable by -> composer/installers[v1.7.0].
    - composer/installers v1.7.0 requires composer-plugin-api ^1.0 -> found composer-plugin-api[2.1.0] but it does not match the constraint.
    - symfony/polyfill-mbstring 1.23.x-dev is an alias of symfony/polyfill-mbstring dev-main and thus requires it to be installed too.
    - easyrdf/easyrdf 0.9.1 requires ext-mbstring * -> satisfiable by symfony/polyfill-mbstring[dev-main, 1.23.x-dev (alias of dev-main)].
    - You can only install one version of a package, so only one of these can be installed: symfony/polyfill-mbstring[dev-main, v1.0.0, ..., v1.23.1].
    - drupal/core-recommended 8.8.x-dev requires easyrdf/easyrdf 0.9.1 -> satisfiable by easyrdf/easyrdf[0.9.1].
    - drupal/core-recommended 8.8.x-dev requires symfony/polyfill-mbstring v1.12.0 -> satisfiable by symfony/polyfill-mbstring[v1.12.0].
    - Root composer.json requires drupal/core-recommended ^8.8 -> satisfiable by drupal/core-recommended[8.8.0-beta1, ..., 8.9.x-dev].

To enable extensions, verify that they are enabled in your .ini files:
    - /etc/php.ini
    - /etc/php.ini
    - /etc/php.d/20-bz2.ini
    - /etc/php.d/20-calendar.ini
    - /etc/php.d/20-ctype.ini
    - /etc/php.d/20-curl.ini
    - /etc/php.d/20-dom.ini
    - /etc/php.d/20-exif.ini
    - /etc/php.d/20-fileinfo.ini
    - /etc/php.d/20-ftp.ini
    - /etc/php.d/20-gd.ini
    - /etc/php.d/20-gettext.ini
    - /etc/php.d/20-iconv.ini
    - /etc/php.d/20-json.ini
    - /etc/php.d/20-mysqlnd.ini
    - /etc/php.d/20-pdo.ini
    - /etc/php.d/20-phar.ini
    - /etc/php.d/20-simplexml.ini
    - /etc/php.d/20-sockets.ini
    - /etc/php.d/20-sqlite3.ini
    - /etc/php.d/20-tokenizer.ini
    - /etc/php.d/20-xml.ini
    - /etc/php.d/20-xmlwriter.ini
    - /etc/php.d/20-xsl.ini
    - /etc/php.d/30-mcrypt.ini
    - /etc/php.d/30-mysqli.ini
    - /etc/php.d/30-pdo_mysql.ini
    - /etc/php.d/30-pdo_sqlite.ini
    - /etc/php.d/30-wddx.ini
    - /etc/php.d/30-xmlreader.ini
    - /etc/php.d/40-zip.ini 

You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

Running php --ini comes up with a matching list


Contents of my composer.json file:

$ clear && cat composer.json
{
  "name": "drupal/recommended-project",
  "description": "Project template for Drupal 8 projects with a relocated document root",
  "type": "project",
  "license": "GPL-2.0-or-later",
  "homepage": "https://www.drupal.org/project/drupal",
  "support": {
  "docs": "https://www.drupal.org/docs/user_guide/en/index.html",
  "chat": "https://www.drupal.org/node/314178"
},
"repositories": [
  {
    "type": "composer",
    "url": "https://packages.drupal.org/8"
  }
],
"require": {
  "composer/installers": "^1.2",
  "drupal/block_class": "^1.3",
  "drupal/bootstrap": "^3.23",
  "drupal/captcha": "^1.2",
  "drupal/core-composer-scaffold": "^8.8",
  "drupal/core-project-message": "^8.8",
  "drupal/core-recommended": "^8.8",
  "drupal/mask": "^2.0@alpha",
  "drupal/recaptcha": "^3.0",
  "drupal/webform": "^6.1"
},
"conflict": {
  "drupal/drupal": "*"
},
"minimum-stability": "dev",
"prefer-stable": true,
"config": {
  "sort-packages": true
},
"extra": {
  "drupal-scaffold": {
    "locations": {
      "web-root": "web/"
    }
  },
  "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/contrib/{$name}": [
      "type:drupal-drush"
    ],
    "web/modules/custom/{$name}": [
      "type:drupal-custom-module"
    ],
    "web/themes/custom/{$name}": [
      "type:drupal-custom-theme"
    ]
  },
  "drupal-core-project-message": {
    "include-keys": [
      "homepage",
      "support"
    ],
    "post-create-project-cmd-message": [
      "<bg=blue;fg=white>                                                         </>",
      "<bg=blue;fg=white>  Congratulations, you’ve installed the Drupal codebase  </>",
      "<bg=blue;fg=white>  from the drupal/recommended-project template!          </>",
      "<bg=blue;fg=white>                                                         </>",
      "",
      "<bg=yellow;fg=black>Next steps</>:",
      "  * Install the site: https://www.drupal.org/docs/8/install",
      "  * Read the user guide: https://www.drupal.org/docs/user_guide/en/index.html",
      "  * Get support: https://www.drupal.org/support",
      "  * Get involved with the Drupal community:",
      "      https://www.drupal.org/getting-involved",
      "  * Remove the plugin that prints this message:",
      "      composer remove drupal/core-project-message"
    ]
  }
}
Hometoy
  • 112
  • 1
  • 12