Skip to content

Composer is not working in vagrant synced folders of a virtual machine #9627

@webprogrammierer

Description

@webprogrammierer

Solution and details

If you experience failed to open stream: No such file or directory or Plugin initialization failed or class not found type of issue, and are using VirtualBox / Vagrant, this is caused by the VirtualBox filesystem being buggy and not allowing access to the files right after they have been written (https://www.virtualbox.org/ticket/8761).

The workaround we implemented is the following:

If Composer:

  • runs as user vagrant
  • or Composer runs on a Linux machine where lsmod lists vboxguest (virtualbox guest additions)
  • or you set the COMPOSER_RUNTIME_ENV environment variable to virtualbox

then Composer does very short sleep() calls right before plugins are initialized to give the filesystem some time to properly acknowledge the files are there, so that the plugins can be initialized.



Initial issue:

  [ErrorException]
  md5_file(./coffee.api.php): failed to open stream: No such file or directory

This error is only an example for a lot of different error messages of Composer 2 when using it in the Virtual Machine (Drupal VM, drupalvm.com).

Composer has massive problem with the files in the shared folders (virtualbox).

Is there any new dev version that solves the problems? The problem exists for many years.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions