johnpbloch / wordpress-core-installer

A composer installer for WordPress core so I can stop saying core is a wordpress-plugin type package.
https://packagist.org/packages/johnpbloch/wordpress-core-installer
GNU General Public License v2.0
207 stars 48 forks source link

Improve exception message #13

Closed GaryJones closed 7 years ago

GaryJones commented 7 years ago

For some reason, I'm hitting the exception here. Any chance of making the accompanying message more useful please, like giving a clue as to which packages it thinks are causing the conflicts?

TCattd commented 7 years ago

I was hitting the same error: "Two packages cannot share the same directory!".

In the case someone come here by Google, in my case i solved like this: Had to remove the require "johnpbloch/wordpress": "*" from my composer.json file, composer update, then re-add the require line, composer update again, and the problem was gone.

But i agree with GaryJones, if possible. Totally.

mrbandfriends-digital commented 7 years ago

This isn't solved for us.

Upon deploying my website I run a composer install. This currently results in an error from this line

https://github.com/johnpbloch/wordpress-core-installer/blob/master/src/johnpbloch/Composer/WordPressCoreInstaller.php#L40

Here is the output from Composer with the verbosity turned up.

Reading ./composer.json
Loading config file ./composer.json
Checked CA file /etc/ssl/certs/ca-certificates.crt: valid
Executing command (/srv/www/{{REDACTED}}/releases/20170517162303): git
branch --no-color --no-abbrev -v
Executing command (/srv/www/{{REDACTED}}/releases/20170517162303): git
describe --exact-match --tags
Executing command (/srv/www/{{REDACTED}}/releases/20170517162303): git log
--pretty="%H" -n1 HEAD
Executing command (/srv/www/{{REDACTED}}/releases/20170517162303): hg
branch
Executing command (/srv/www/{{REDACTED}}/releases/20170517162303): fossil
branch list
Executing command (/srv/www/{{REDACTED}}/releases/20170517162303): fossil
tag list
Executing command (/srv/www/{{REDACTED}}/releases/20170517162303): svn
info --xml
Failed to initialize global composer: Composer could not find the config
file: /home/web/.config/composer/composer.json
To initialize a project, please create a composer.json file as described in
the https://getcomposer.org/ "Getting Started" section
Reading /srv/www/{{REDACTED}}/releases/20170517162303/vendor/composer/inst
alled.json
Loading plugin johnpbloch\Composer\WordPressCorePlugin
Loading plugin Composer\Installers\Plugin
Running 1.4.2 (2017-05-17 08:17:52) with PHP 7.0.8-4+deb.sury.org~trusty+1 on
Linux / 3.16.0-45-generic
Reading ./composer.lock
Loading composer repositories with package information
Installing dependencies from lock file
Reading ./composer.lock
Resolving dependencies through SAT
Dependency resolution completed in 0.001 seconds
Analyzed 98 packages to resolve dependencies
Analyzed 135 rules to resolve dependencies
Package operations: 24 installs, 1 update, 0 removals
Installs: advanced-custom-fields/advanced-custom-fields-pro:5.3.9.2,
johnpbloch/wordpress-core:4.7.5, wpackagist-plugin/akismet:3.3.2, wpackagist-
plugin/better-wp-security:6.2.1, wpackagist-plugin/breadcrumb-trail:1.0.0,
wpackagist-plugin/disable-comments:1.6, wpackagist-plugin/duplicate-post:3.2,
wpackagist-plugin/enhanced-media-library:2.4.4, wpackagist-plugin/ewww-image-
optimizer:3.3.1, wpackagist-plugin/force-strong-passwords:1.7, wpackagist-
plugin/location-nav-menu-for-acf:1.1.1, wpackagist-plugin/members:1.1.3,
wpackagist-plugin/posts-to-posts:1.6.5, wpackagist-plugin/relevanssi:3.5.9.1,
wpackagist-plugin/rewrite-rules-inspector:1.2.1, wpackagist-plugin/safe-
redirect-manager:1.7.8, wpackagist-plugin/simple-301-redirects:1.07,
wpackagist-plugin/simple-301-redirects-addon-bulk-uploader:1.0.14,
wpackagist-plugin/stop-user-enumeration:1.3.8, wpackagist-
plugin/stream:3.2.0, wpackagist-plugin/sucuri-scanner:1.8.3, wpackagist-
plugin/user-switching:1.0.9, wpackagist-plugin/wordpress-seo:4.7.1,
wpackagist-plugin/wp-optimize:2.1.1
Updates: composer/installers:v1.3.0
  - Updating composer/installers (v1.2.0 => v1.3.0): Reading /home/web/.cache
/composer/files/composer/installers/41f0abb210f1e24fcf418eaec2b2524695cdb5d1.
zip from cache
Loading from cache Extracting archive
    REASON: Required by the root package: Install command rule (install
composer/installers v1.3.0)

  - Installing advanced-custom-fields/advanced-custom-fields-pro (5.3.9.2):
Reading /home/web/.cache/composer/files/advanced-custom-fields/advanced-
custom-fields-pro/0d10b03837e2f9e431d70a26524565f9a08e9845.zip from cache
Loading from cache
 Extracting archive    REASON: Required by the root package: Install command
rule (install advanced-custom-fields/advanced-custom-fields-pro 5.3.9.2)

  [InvalidArgumentException]
  Two packages cannot share the same directory!

Exception trace:
 () at /srv/www/{{REDACTED}}/releases/20170517162303/vendor/johnpbloch
/wordpress-core-
installer/src/johnpbloch/Composer/WordPressCoreInstaller.php:40
 johnpbloch\Composer\WordPressCoreInstaller->getInstallPath() at
phar:///usr/local/bin/composer/src/Composer/Installer/LibraryInstaller.php:83
 Composer\Installer\LibraryInstaller->install() at phar:///usr/local/bin/comp
oser/src/Composer/Installer/InstallationManager.php:173
 Composer\Installer\InstallationManager->install() at phar:///usr/local/bin/c
omposer/src/Composer/Installer/InstallationManager.php:160
 Composer\Installer\InstallationManager->execute() at
phar:///usr/local/bin/composer/src/Composer/Installer.php:584
 Composer\Installer->doInstall() at
phar:///usr/local/bin/composer/src/Composer/Installer.php:223
 Composer\Installer->run() at
phar:///usr/local/bin/composer/src/Composer/Command/InstallCommand.php:119
 Composer\Command\InstallCommand->execute() at
phar:///usr/local/bin/composer/vendor/symfony/console/Command/Command.php:267
 Symfony\Component\Console\Command\Command->run() at
phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:846
 Symfony\Component\Console\Application->doRunCommand() at
phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:191
 Symfony\Component\Console\Application->doRun() at
phar:///usr/local/bin/composer/src/Composer/Console/Application.php:227
 Composer\Console\Application->doRun() at
phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:122
 Symfony\Component\Console\Application->run() at
phar:///usr/local/bin/composer/src/Composer/Console/Application.php:100
 Composer\Console\Application->run() at
phar:///usr/local/bin/composer/bin/composer:54
 require() at /usr/local/bin/composer:24

install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev]
[--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress]
[--no-suggest] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a
|--classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--]
[<packages>]...
fatal: [162.13.106.128]: FAILED! => {"changed": true, "cmd": ["composer", "install", "--no-ansi", "--no-dev", "--no-interaction", "--no-progress", "--optimize-autoloader", "--no-scripts", "-vvv"], "delta": "0:00:00.483702", "end": "2017-05-17 16:23:15.931668", "failed": true, "rc": 1, "start": "2017-05-17 16:23:15.447966", "stderr": "Reading ./composer.json\nLoading config file ./composer.json\nChecked CA file /etc/ssl/certs/ca-certificates.crt: valid\nExecuting command (/srv/www/{{REDACTED}}/releases/20170517162303): git branch --no-color --no-abbrev -v\nExecuting command (/srv/www/{{REDACTED}}/releases/20170517162303): git describe --exact-match --tags\nExecuting command (/srv/www/{{REDACTED}}/releases/20170517162303): git log --pretty=\"%H\" -n1 HEAD\nExecuting command (/srv/www/{{REDACTED}}/releases/20170517162303): hg branch\nExecuting command (/srv/www/{{REDACTED}}/releases/20170517162303): fossil branch list\nExecuting command (/srv/www/{{REDACTED}}/releases/20170517162303): fossil tag list\nExecuting command (/srv/www/{{REDACTED}}/releases/20170517162303): svn info --xml\nFailed to initialize global composer: Composer could not find the config file: /home/web/.config/composer/composer.json\nTo initialize a project, please create a composer.json file as described in the https://getcomposer.org/ \"Getting Started\" section\nReading /srv/www/{{REDACTED}}/releases/20170517162303/vendor/composer/installed.json\nLoading plugin johnpbloch\\Composer\\WordPressCorePlugin\nLoading plugin Composer\\Installers\\Plugin\nRunning 1.4.2 (2017-05-17 08:17:52) with PHP 7.0.8-4+deb.sury.org~trusty+1 on Linux / 3.16.0-45-generic\nReading ./composer.lock\nLoading composer repositories with package information\nInstalling dependencies from lock file\nReading ./composer.lock\nResolving dependencies through SAT\nDependency resolution completed in 0.001 seconds\nAnalyzed 98 packages to resolve dependencies\nAnalyzed 135 rules to resolve dependencies\nPackage operations: 24 installs, 1 update, 0 removals\nInstalls: advanced-custom-fields/advanced-custom-fields-pro:5.3.9.2, johnpbloch/wordpress-core:4.7.5, wpackagist-plugin/akismet:3.3.2, wpackagist-plugin/better-wp-security:6.2.1, wpackagist-plugin/breadcrumb-trail:1.0.0, wpackagist-plugin/disable-comments:1.6, wpackagist-plugin/duplicate-post:3.2, wpackagist-plugin/enhanced-media-library:2.4.4, wpackagist-plugin/ewww-image-optimizer:3.3.1, wpackagist-plugin/force-strong-passwords:1.7, wpackagist-plugin/location-nav-menu-for-acf:1.1.1, wpackagist-plugin/members:1.1.3, wpackagist-plugin/posts-to-posts:1.6.5, wpackagist-plugin/relevanssi:3.5.9.1, wpackagist-plugin/rewrite-rules-inspector:1.2.1, wpackagist-plugin/safe-redirect-manager:1.7.8, wpackagist-plugin/simple-301-redirects:1.07, wpackagist-plugin/simple-301-redirects-addon-bulk-uploader:1.0.14, wpackagist-plugin/stop-user-enumeration:1.3.8, wpackagist-plugin/stream:3.2.0, wpackagist-plugin/sucuri-scanner:1.8.3, wpackagist-plugin/user-switching:1.0.9, wpackagist-plugin/wordpress-seo:4.7.1, wpackagist-plugin/wp-optimize:2.1.1\nUpdates: composer/installers:v1.3.0\n  - Updating composer/installers (v1.2.0 => v1.3.0): Reading /home/web/.cache/composer/files/composer/installers/41f0abb210f1e24fcf418eaec2b2524695cdb5d1.zip from cache\nLoading from cache Extracting archive\n    REASON: Required by the root package: Install command rule (install composer/installers v1.3.0)\n\n  - Installing advanced-custom-fields/advanced-custom-fields-pro (5.3.9.2): Reading /home/web/.cache/composer/files/advanced-custom-fields/advanced-custom-fields-pro/0d10b03837e2f9e431d70a26524565f9a08e9845.zip from cache\nLoading from cache\n Extracting archive    REASON: Required by the root package: Install command rule (install advanced-custom-fields/advanced-custom-fields-pro 5.3.9.2)\n\n\n                                                 \n  [InvalidArgumentException]                     \n  Two packages cannot share the same directory!  \n                                                 \n\nException trace:\n () at /srv/www/{{REDACTED}}/releases/20170517162303/vendor/johnpbloch/wordpress-core-installer/src/johnpbloch/Composer/WordPressCoreInstaller.php:40\n johnpbloch\\Composer\\WordPressCoreInstaller->getInstallPath() at phar:///usr/local/bin/composer/src/Composer/Installer/LibraryInstaller.php:83\n Composer\\Installer\\LibraryInstaller->install() at phar:///usr/local/bin/composer/src/Composer/Installer/InstallationManager.php:173\n Composer\\Installer\\InstallationManager->install() at phar:///usr/local/bin/composer/src/Composer/Installer/InstallationManager.php:160\n Composer\\Installer\\InstallationManager->execute() at phar:///usr/local/bin/composer/src/Composer/Installer.php:584\n Composer\\Installer->doInstall() at phar:///usr/local/bin/composer/src/Composer/Installer.php:223\n Composer\\Installer->run() at phar:///usr/local/bin/composer/src/Composer/Command/InstallCommand.php:119\n Composer\\Command\\InstallCommand->execute() at phar:///usr/local/bin/composer/vendor/symfony/console/Command/Command.php:267\n Symfony\\Component\\Console\\Command\\Command->run() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:846\n Symfony\\Component\\Console\\Application->doRunCommand() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:191\n Symfony\\Component\\Console\\Application->doRun() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:227\n Composer\\Console\\Application->doRun() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:122\n Symfony\\Component\\Console\\Application->run() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:100\n Composer\\Console\\Application->run() at phar:///usr/local/bin/composer/bin/composer:54\n require() at /usr/local/bin/composer:24\n\ninstall [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--] [<packages>]...", "stdout": "", "stdout_lines": [], "warnings": []}

This website has existed for a while and this error has only just started happening. I've already jumped through the usual hoops of upgrading to the meta wordpress packages since you changed the way your packages worked but this has had no effect.

Here is my composer.json. Is there anything obviously wrong in the way that you can see I'm using your packages?

{
  "name": "roots/bedrock",
  "type": "project",
  "license": "MIT",
  "description": "A modern WordPress stack",
  "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", "roots", "wordpress", "stack", "composer", "vagrant", "wp"
  ],
  "support": {
    "issues": "https://github.com/roots/bedrock/issues",
    "forum": "https://discourse.roots.io/category/bedrock"
  },
  "config": {
    "preferred-install": "dist"
  },
  "repositories": [
    {
      "type": "composer",
      "url": "https://wpackagist.org"
    },
    {
      "type": "package",
      "package": {
        "name": "advanced-custom-fields/advanced-custom-fields-pro",
        "version": "5.3.9.2",
        "type": "wordpress-plugin",
        "dist": {
          "type": "zip",
          "url": "https://connect.advancedcustomfields.com/index.php?{{REDACTED}}"
        }
      }
    }
  ],
  "require": {
    "php": ">=5.5",
    "composer/installers": "~1.2.0",
    "vlucas/phpdotenv": "^2.0.1",
    "oscarotero/env": "^1.0",
    "roots/wp-password-bcrypt": "1.0.0",
    "wpackagist-plugin/akismet": "^3.0",
    "wpackagist-plugin/safe-redirect-manager": "^1.7",
    "wpackagist-plugin/duplicate-post": "^3.1",
    "wpackagist-plugin/disable-comments": "^1.2",
    "wpackagist-plugin/stream": "^3.0",
    "wpackagist-plugin/sucuri-scanner": "*",
    "wpackagist-plugin/rewrite-rules-inspector": "^1.2",
    "advanced-custom-fields/advanced-custom-fields-pro": "^5.3.9.2",
    "wpackagist-plugin/wp-optimize": "^2.1",
    "wpackagist-plugin/posts-to-posts": "^1.6",
    "wpackagist-plugin/wordpress-seo": "^4.4",
    "wpackagist-plugin/user-switching": "^1.0.9",
    "wpackagist-plugin/ewww-image-optimizer": "*",
    "wpackagist-plugin/members": "^1.1.1",
    "wpackagist-plugin/relevanssi": "^3.5.8",
    "wpackagist-plugin/breadcrumb-trail": "^1.0.0",
    "wpackagist-plugin/location-nav-menu-for-acf": "*",
    "wpackagist-plugin/force-strong-passwords": "*",
    "jjgrainger/wp-custom-post-type-class": "dev-master",
    "wpackagist-plugin/better-wp-security": "^6.1.0",
    "wpackagist-plugin/enhanced-media-library": "^2.4",
    "wpackagist-plugin/simple-301-redirects": "^1.07",
    "wpackagist-plugin/simple-301-redirects-addon-bulk-uploader": "^1.0",
    "wpackagist-plugin/stop-user-enumeration": "^1.3",
    "johnpbloch/wordpress-core-installer": "^0.2.1",
    "johnpbloch/wordpress-core": "^4.7"
  },
  "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": {
    "test": [
      "vendor/bin/phpcs --ignore=web/wp/,vendor/ -n -s ."
    ]
  }
}