PHPCSStandards / composer-installer

Composer installer for PHP_CodeSniffer coding standards
https://packagist.org/packages/dealerdirect/phpcodesniffer-composer-installer
MIT License
552 stars 36 forks source link

InvalidArgumentException: $from and $to must be absolute paths #83

Closed sherakama closed 3 years ago

sherakama commented 5 years ago

Problem/Motivation

Error when running composer install

Expected behaviour

No errors

Actual behaviour

composer install --prefer-source -vvv                                                                                                 
Reading ./composer.json
Loading plugin Composer\Installers\Plugin
Loading plugin Acquia\Blt\Composer\Plugin
Loading plugin cweagans\Composer\Patches
Loading plugin DavidBarratt\CustomInstaller\CustomInstallerPlugin
Loading plugin DrupalComposer\DrupalScaffold\Plugin
Loading plugin Drupal\Console\Composer\Plugin\Extender
Loading plugin grasmash\DrupalSecurityWarning\Composer\Plugin
Loading plugin PackageVersions\Installer
Loading plugin OomphInc\ComposerInstallersExtender\Plugin
Loading plugin zaporylie\ComposerDrupalOptimizations\Plugin
Loading plugin Dealerdirect\Composer\Plugin\Installers\PHPCodeSniffer\Plugin
Loading plugin Hirak\Prestissimo\Plugin
Running 1.8.6 (2019-06-11 15:03:05) with PHP 7.3.7 on Darwin / 18.6.0
Reading ./composer.lock
Gathering patches for root package.
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Reading ./composer.lock
Resolving dependencies through SAT
Looking at all rules.

Nothing to install or update

Generating autoload files
ocramius/package-versions:  Generating version class...
ocramius/package-versions: ...done generating version class

Running PHPCodeSniffer Composer Installer
Executing command (/httpdocs/acsf.cardinalsites/vendor/bin): phpcs --config-show installed_paths

  [InvalidArgumentException]
  $from (vendor/squizlabs/php_codesniffer/) and $to (/httpdocs/acsf.cardinalsites/vendor/drupal/coder/coder_sniffer) must be absolute paths.

Exception trace:
 () at phar:///usr/local/Cellar/composer/1.8.6/bin/composer/src/Composer/Util/Filesystem.php:358
 Composer\Util\Filesystem->findShortestPath() at /Users/admin/.composer/vendor/dealerdirect/phpcodesniffer-composer-installer/src/Plugin.php:330
 Dealerdirect\Composer\Plugin\Installers\PHPCodeSniffer\Plugin->updateInstalledPaths() at /Users/admin/.composer/vendor/dealerdirect/phpcodesniffer-composer-installer/src/Plugin.php:174
 Dealerdirect\Composer\Plugin\Installers\PHPCodeSniffer\Plugin->onDependenciesChangedEvent() at n/a:n/a
 call_user_func() at phar:///usr/local/Cellar/composer/1.8.6/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:176
 Composer\EventDispatcher\EventDispatcher->doDispatch() at phar:///usr/local/Cellar/composer/1.8.6/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:96
 Composer\EventDispatcher\EventDispatcher->dispatchScript() at phar:///usr/local/Cellar/composer/1.8.6/bin/composer/src/Composer/Installer.php:324
 Composer\Installer->run() at phar:///usr/local/Cellar/composer/1.8.6/bin/composer/src/Composer/Command/InstallCommand.php:122
 Composer\Command\InstallCommand->execute() at phar:///usr/local/Cellar/composer/1.8.6/bin/composer/vendor/symfony/console/Command/Command.php:245
 Symfony\Component\Console\Command\Command->run() at phar:///usr/local/Cellar/composer/1.8.6/bin/composer/vendor/symfony/console/Application.php:835
 Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/Cellar/composer/1.8.6/bin/composer/vendor/symfony/console/Application.php:185
 Symfony\Component\Console\Application->doRun() at phar:///usr/local/Cellar/composer/1.8.6/bin/composer/src/Composer/Console/Application.php:258
 Composer\Console\Application->doRun() at phar:///usr/local/Cellar/composer/1.8.6/bin/composer/vendor/symfony/console/Application.php:117
 Symfony\Component\Console\Application->run() at phar:///usr/local/Cellar/composer/1.8.6/bin/composer/src/Composer/Console/Application.php:104
 Composer\Console\Application->run() at phar:///usr/local/Cellar/composer/1.8.6/bin/composer/bin/composer:61
 require() at /usr/local/Cellar/composer/1.8.6/bin/composer:24

Steps to reproduce

I will work on this as I gather more information. See output above.

Proposed changes

Not sure yet, posting issue and I will continue to debug.

sherakama commented 5 years ago

It appears that having installed dealerdirect/phpcodesniffer-composer-installer in my user's home directory ~/.composer/vendor/...etc and having a copy in my local project /httpdocs/website/vendor/...etc caused a mismatch in paths. Removing the one in my user's home directory has resolved the issue but I am going to need it there so I will continue to debug.

Potherca commented 4 years ago

Version v0.6.0 has just been released. Besides several fixes, this version also adds improved debug/verbose output.

@sherakama Could you try to reproduce the issue you reported with v0.6.0 and let us know if it still happens? If so, please run the plugin in verbose mode and paste the output of the run here (that should make it possible for us to re-produce the issue ourselves).

jrfnl commented 4 years ago

@sherakama Any feedback ? I would love to know if this is still an issue or if this can be closed.

Potherca commented 4 years ago

@sherakama / @jrfnl If there is no response to this ticket by August 28, I am closing this ticket before September 1st.

ossobuffo commented 3 years ago

I am seeing this behavior using latest git-master when using Composer 2.

[InvalidArgumentException]                                                                                                       
  $from (web/libraries/php_codesniffer/) and $to (/{snip}/vendor/drupal/coder/coder_sniffer) must be absolute paths.
jrfnl commented 3 years ago

@ossobuffo Could you provide us with a scenario with which this can be reproduced consistently ? Please have a look at the current bug report template to see the kind of details we'd need to investigate this.

ossobuffo commented 3 years ago

@jrfnl It turns out that I had configured a non-default location for library composer packages to be installed. Once I removed that configuration, it worked fine. Sorry for the noise.

jrfnl commented 3 years ago

@ossobuffo Thanks for getting back to us. Glad it is solved.

As it's after Sept 1st, per @Potherca's previous comment, I'll close the issue now.

If someone else runs into this at a later point, please open a new issue with sufficient information to reproduce the error.