Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

composer update error #91

Open
amadrid196 opened this issue Nov 21, 2017 · 10 comments
Open

composer update error #91

amadrid196 opened this issue Nov 21, 2017 · 10 comments

Comments

@amadrid196
Copy link

$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating optimized autoload files

Illuminate\Foundation\ComposerScripts::postUpdate
PHP Warning: Uncaught ErrorException: require(C:\Users\Gary-Carvajal\Documents\GitHub\blsempl_unah\vendor\composer/../myclabs/deep-copy/src/DeepCopy/deep_copy.php): failed to open stream: No such file or directory in C:\Users\Gary-Carvajal\Documents\GitHub\blsempl_unah\vendor\composer\autoload_real.php:66
Stack trace:
#0 C:\Users\Gary-Carvajal\Documents\GitHub\blsempl_unah\vendor\composer\autoload_real.php(66): Composer\Util\ErrorHandler::handle(2, 'require(C:\User...', 'C:\Users\Gary-C...', 66, Array)
#1 C:\Users\Gary-Carvajal\Documents\GitHub\blsempl_unah\vendor\composer\autoload_real.php(66): require()
#2 C:\Users\Gary-Carvajal\Documents\GitHub\blsempl_unah\vendor\composer\autoload_real.php(56): composerRequirec1eacf11190380a1fd3b9f0e78877bfb('6124b4c8570aa39...', 'C:\Users\Gary-C...')
#3 C:\Users\Gary-Carvajal\Documents\GitHub\blsempl_unah\vendor\autoload.php(7): ComposerAutoloaderInitc1eacf11190380a1fd3b9f0e78877bfb::getLoader()
#4 C:\Users\Gary-Carvajal\Documents\GitHub\blsempl_unah\vendor\laravel\framework\src in C:\Users\Gary-Carvajal\Documents\GitHub\blsempl_unah\vendor\composer\autoload_real.php on line 66

Warning: Uncaught ErrorException: require(C:\Users\Gary-Carvajal\Documents\GitHub\blsempl_unah\vendor\composer/../myclabs/deep-copy/src/DeepCopy/deep_copy.php): failed to open stream: No such file or directory in C:\Users\Gary-Carvajal\Documents\GitHub\blsempl_unah\vendor\composer\autoload_real.php:66
Stack trace:
#0 C:\Users\Gary-Carvajal\Documents\GitHub\blsempl_unah\vendor\composer\autoload_real.php(66): Composer\Util\ErrorHandler::handle(2, 'require(C:\User...', 'C:\Users\Gary-C...', 66, Array)
#1 C:\Users\Gary-Carvajal\Documents\GitHub\blsempl_unah\vendor\composer\autoload_real.php(66): require()
#2 C:\Users\Gary-Carvajal\Documents\GitHub\blsempl_unah\vendor\composer\autoload_real.php(56): composerRequirec1eacf11190380a1fd3b9f0e78877bfb('6124b4c8570aa39...', 'C:\Users\Gary-C...')
#3 C:\Users\Gary-Carvajal\Documents\GitHub\blsempl_unah\vendor\autoload.php(7): ComposerAutoloaderInitc1eacf11190380a1fd3b9f0e78877bfb::getLoader()
#4 C:\Users\Gary-Carvajal\Documents\GitHub\blsempl_unah\vendor\laravel\framework\src in C:\Users\Gary-Carvajal\Documents\GitHub\blsempl_unah\vendor\composer\autoload_real.php on line 66
PHP Fatal error: composerRequirec1eacf11190380a1fd3b9f0e78877bfb(): Failed opening required 'C:\Users\Gary-Carvajal\Documents\GitHub\blsempl_unah\vendor\composer/../myclabs/deep-copy/src/DeepCopy/deep_copy.php' (include_path='C:\xampp\php\PEAR') in C:\Users\Gary-Carvajal\Documents\GitHub\blsempl_unah\vendor\composer\autoload_real.php on line 66

Fatal error: composerRequirec1eacf11190380a1fd3b9f0e78877bfb(): Failed opening required 'C:\Users\Gary-Carvajal\Documents\GitHub\blsempl_unah\vendor\composer/../myclabs/deep-copy/src/DeepCopy/deep_copy.php' (include_path='C:\xampp\php\PEAR') in C:\Users\Gary-Carvajal\Documents\GitHub\blsempl_unah\vendor\composer\autoload_real.php on line 66

When updating the composer gives me this error if someone has the solution please could you help me......

@theofidry
Copy link
Collaborator

rm vendor and install your deps again?

@amadrid196
Copy link
Author

that happened to me when I gave composer update

@theofidry
Copy link
Collaborator

The problem seems to come from Illuminate\Foundation\ComposerScripts::postUpdate, so if I were you I would look there

@theofidry
Copy link
Collaborator

Closing as I doubt that the issue is coming from DeepCopy. Feel free to provide more information if something hints otherwise

@deleugpn
Copy link

I started getting this error now after running composer install --no-dev. DeepCopy gets removed and then the dump-autoload fails at this point. Seems pretty hard to debug.

@theofidry
Copy link
Collaborator

Maybe a script tries to execute it although it's no longer here since is a dev dependency?

@deleugpn
Copy link

So far what I've gather is that deep-copy gets installed by phpunit

sh-4.2# /tmp/composer why myclabs/deep-copy
myclabs/deep-copy  1.9.5  replaces  myclabs/deep-copy (self.version)
phpunit/phpunit    8.5.4  requires  myclabs/deep-copy (^1.9.1)

This is my composer

    "require": {
        "php": "^7.1.3",
        "aws/aws-sdk-php": "^3.69",
        "bref/bref": "^0.5.15",
        "customergauge/service-discovery": "dev-master",
        "doctrine/dbal": "^2.9",
        "fzaninotto/faker": "~1.4",
        "laravel/framework": "^6.0",
        "laravel/tinker": "^2.2"
    },
    "require-dev": {
        "mockery/mockery": "^1.0",
        "nunomaduro/collision": "^3.0",
        "phpunit/phpunit": "^8.0",
        "roave/security-advisories": "dev-master"
    },

And when checking the autoload_static.php file generated by Composer, I see

        '6124b4c8570aa390c21fafd04a26c69f' => __DIR__ . '/..' . '/myclabs/deep-copy/src/DeepCopy/deep_copy.php',

as in

    public static $files = array (
        '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
        '25072dd6e2470089de65ae7bf11d3109' => __DIR__ . '/..' . '/symfony/polyfill-php72/bootstrap.php',
        'f598d06aa772fa33d905e87be6398fb1' => __DIR__ . '/..' . '/symfony/polyfill-intl-idn/bootstrap.php',
        '0d59ee240a4cd96ddbb4ff164fccea4d' => __DIR__ . '/..' . '/symfony/polyfill-php73/bootstrap.php',
        '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
        'c964ee0ededf28c96ebd9db5099ef910' => __DIR__ . '/..' . '/guzzlehttp/promises/src/functions_include.php',
        '7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php',
        'a0edc8309cc5e1d60e3047b5df6b7052' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/functions_include.php',
        '667aeda72477189d0494fecd327c3641' => __DIR__ . '/..' . '/symfony/var-dumper/Resources/functions/dump.php',
        '37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php',
        'b067bc7112e384b61c701452d53a14a8' => __DIR__ . '/..' . '/mtdowling/jmespath.php/src/JmesPath.php',
        'def43f6c87e4f8dfd0c9e1b1bab14fe8' => __DIR__ . '/..' . '/symfony/polyfill-iconv/bootstrap.php',
        '8a9dc1de0ca7e01f3e08231539562f61' => __DIR__ . '/..' . '/aws/aws-sdk-php/src/functions.php',
        '2c102faa651ef8ea5874edb585946bce' => __DIR__ . '/..' . '/swiftmailer/swiftmailer/lib/swift_required.php',
        '538ca81a9a966a6716601ecf48f4eaef' => __DIR__ . '/..' . '/opis/closure/functions.php',
        'e39a8b23c42d4e1452234d762b03835a' => __DIR__ . '/..' . '/ramsey/uuid/src/functions.php',
        'f0906e6318348a765ffb6eb24e0d0938' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/helpers.php',
        '58571171fd5812e6e447dce228f52f4d' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/helpers.php',
        '6124b4c8570aa390c21fafd04a26c69f' => __DIR__ . '/..' . '/myclabs/deep-copy/src/DeepCopy/deep_copy.php',
        '801c31d8ed748cfa537fa45402288c95' => __DIR__ . '/..' . '/psy/psysh/src/functions.php',
        '22449bb9c325974bb29a0204db1fec0d' => __DIR__ . '/..' . '/bref/bref/src/functions.php',
    );

I'm guessing the presence of this in the dump file is the source of the problem, however I cannot change this file for debugging purpose as it gets overwritten by composer everytime.

I'm still digging.

@deleugpn
Copy link

deleugpn commented Apr 24, 2020

So I finally got to the bottom of this. There's only 2 things hard in computer science: naming things and cache invalidation.

This issue came up on my CI when running a sequence:

  • composer install
  • ./vendor/bin/phpunit
  • composer install --no-dev

Since I'm using bref-php dev image, it comes with, surprise surprise, opcache enabled. Then Composer generates an autoload for dev, it gets cached by opcache which ignores any file changes after running composer install no-dev.

If anyone in the future lands here with this issue, the 1) action to take is remove the entire vendor folder and try again. If that doesn't work, check if you're installing dev dependencies with opcache enabled.

@theofidry
Copy link
Collaborator

Maybe this can be added to a troubleshooting page: this issue & the parse token error (due to using PHP 5 with this 7+ library) are two recurring issues

@theofidry theofidry reopened this Apr 24, 2020
@muarachmann
Copy link

Okay.... I saw this thread only today cause I had the same error and almost got frustrated after trying several solutions like

rm -rf vendor of my project
composer dump-autoload which always resulted to another error

  [RuntimeException]
  Could not scan for classes inside "~/.composer/vendor/symfony/polyfill-intl-normalizer/Resources/stubs" which does not
   appear to be a file nor a folder
dump-autoload [--no-scripts] [-o|--optimize] [-a|--classmap-authoritative] [--apcu] [--no-dev]

I don't think this is an issue with DeepCopy, maybe a project messed up with composer somehow, somewhere. I was interested by the first part of this solution - https://stackoverflow.com/a/49876383

So what I rapidly did was, I located my composers global dir, navigated into it and removed the vendor folder and composer.lock. Then ran composer install again. So in my case here is what I did ...

cd /Users/muarachmann/.composer
rm -rf vendor
rm composer.lock
composer install

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants