pixelfear / composer-dist-plugin

Composer package that downloads distributable assets to be used in packages so you don't have to commit them.
MIT License
28 stars 2 forks source link

Error when "composer install" (initial project statamic/statamic) #5

Open felixstoessel opened 3 years ago

felixstoessel commented 3 years ago

Hello,

I am using a Statamic project (from the statamic/statamic repo). When deleting the vendor/ and composer.lock and trying to do a composer install, I get following error:

error

I am using Composer version 1.10.19 and also tested with Composer 2. I am on Homestead and macOS.

jasonvarga commented 3 years ago

Try a composer clear-cache and try again. If you've deleted vendor, I don't think it's an issue with this plugin.

felixstoessel commented 3 years ago

I tried this, didn't work. I also tried composer install --no-cache and deleting some funny ~/.cache/composer and ~/.composer/cache files.

jasonvarga commented 3 years ago

Is the path that you've blurred out definitely correct? Does that directory that it couldn't exist actually exist?

What version of PHP are you using?

felixstoessel commented 3 years ago

Yeah, does exists. PHP 7.4 in use.

jasonvarga commented 3 years ago

I'm out of ideas. I wonder if it's something specific to Homestead. I'll try spinning one up when I have a chance. Do you have the ability to try installing this outside of Homestead?

nimiboid commented 3 years ago

I'm experiencing the issue as well - homestead (vbox) on win10. Tried as well in elevated user mode to bring vagrant up; tried as well sudo composer; tried both composer 1 and 2. Same issue. The interesting part - file is there: image

jasonvarga commented 3 years ago

When did you create your homestead box? Can you upgrade?

This sounds the same as the thread here, specifically this comment telling you that upgrading your box should fix it. https://github.com/laravel/homestead/issues/1240#issuecomment-515500927

There's also the suggestion that running composer install --prefer-source may work. https://github.com/laravel/homestead/issues/1240#issuecomment-555951201

nimiboid commented 3 years ago

@jasonvarga actually I did try to update homestead yesterday, from 9.6 to 10.x but for some weird reason I couldn't. I did even a full reinstall of homestead but vagrant kept on insisting to use 9.6 .... weird.

I will try to update homestead to latest tomorrow and will post back here the results.

Thank you for the support.

nimiboid commented 3 years ago

@jasonvarga turns out I was using the latest homestead, however latest in the 9.x settler branch which is based on ubuntu 18.04.

I did try today a clean install of the latest homestead in the 10.x settler version based on ubuntu 20.04. Same error: Plugin installation failed (include(/home/vagrant/mz2s/mz2s/vendor/pixelfear/composer-dist-plugin/src/Plugin.php): failed to open stream: No such file or directory), rolling back but file is actually there and permissions are correct.

I'm open for suggestions to try out.

nimiboid commented 3 years ago

Happy to report that I've come around this issue.

@jasonvarga thank you for pointing me in the direction of laravel/homestead#1240 It is a long but very interesting read.

It turns out the issue has nothing to do with pixelfear's composer-dist-plugin, nor with composer, even less with homestead or settler for that matter. It is a problem with vboxsf of VirtualBox which - it turns out - is slow for composer.

I successfully tried both workarounds: a) install statamic via composer using --prefer-source b) rebuild vagrant box with mount type smb for the shared folder and then use the statamic installer

Even though I'm not the original author of the issue I think it is fair to say that it can be closed as it has nothing to do with composer-dist-plugin.

felixstoessel commented 3 years ago

@nimiboid But why does this issue appear for different user and the same issue appears? Random or some specific code logic that triggers that issue?

nimiboid commented 3 years ago

@felixstoessel It seems that the issues is connected with a following setup: windows host and vagrant with virtualbox provider. Why does it happen exactly on the same composer package for both of us is unclear to me. But I think it is safe bet it is not connected with the package itself but rather with virtualbox as proven by the switch ceterus paribus from vboxfs to smb.

felixstoessel commented 3 years ago

Hmm. I am on a macOS host (Mojave 10.15.7). I just wonder why this only happen with my Statamic projects and not with non-Statamic. Everything on Laravel Homestead and VirtualBox, but different outcomes depending on the PHP project. So I assume it has to do with this plugin.

nimiboid commented 3 years ago

@felixstoessel my bad, I was under the impression you're running windows host as well. Those are valid questions.

Are your running vagrant with the virtualbox provider? If yes, maybe you could try out the parallels provider.

jasonvarga commented 3 years ago

If you're saying its because it's too slow - it could be that Statamic projects will use this Composer plugin, and Composer plugins are installed before everything else. Maybe it happens early enough for the slowness to be a problem, and you just don't see it in non-Statamic projects because they don't use Composer plugins.

Really just completely guessing here though.

felixstoessel commented 3 years ago

All my non-statamic projects use Composer plugins.

It is just interesting, because the bug appears always with this particular Composer plugin.

jasonvarga commented 3 years ago

What other Composer plugins are you using in your other projects?

elliottregan commented 3 years ago

I hit this same issue using a custom Vagrant box, not Homestead. Installing statamic via composer using --prefer-source worked for me.