Skip to content

Title: package:discover Fails on Windows Due to File Lock (rename(...): The process cannot access the file...) #57672

@zeus0219

Description

@zeus0219

Laravel Version

9.19

PHP Version

8.2

Database Driver & Version

No response

Description

During the composer update or composer install process, the post-autoload-dump event, which runs php artisan package:discover, fails on Windows environments. The failure occurs when the Filesystem attempts to rename a temporary cache file, but the file is locked by another process (likely an antivirus or file indexing service), causing a "permission denied" error.

This is a common race condition and file locking issue on Windows, particularly when the bootstrap/cache directory is being scanned by third-party software.

In Filesystem.php line 219:

rename(...\bootstrap\cache\pacDE7.tmp, ...\bootstrap\cache/packages.ph
  p): The process cannot access the the file because it is being used by another process (code: 32)

Steps To Reproduce

  1. Set up a Laravel project on a Windows machine.
  2. Run composer update or composer install.
  3. The error has a high probability of occurring if a real-time antivirus scanner or Windows Search Indexer is active. The issue is intermittent.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions