laravel / homestead

MIT License
3.87k stars 1.44k forks source link

Symfony Flex is not working inside Homestead VM #871

Closed Kocal closed 6 years ago

Kocal commented 6 years ago

Versions

Host operating system

Debian 9.4 (stretch), with Linux 4.9.0-6-amd64.

Homestead.yaml

ip: 192.168.10.10
memory: 2048
cpus: 2
provider: virtualbox
mariadb: true
authorize: ~/.ssh/id_rsa.pub
keys:
    - ~/.ssh/id_rsa
folders:
    -
        map: /home/kocal/Dev/Mangatheque
        to: /home/vagrant/code
sites:
    -
        map: mangatheque.vm
        to: /home/vagrant/code/public
        type: symfony4
databases:
    - homestead
name: mangatheque
hostname: mangatheque

Vagrant destroy & up output

https://gist.github.com/Kocal/fffa6fd8622f6e28cd30d0c4d930a0ad

Expected behavior

With the Composer Flex Symfony Flex, I can require dependencies by using Symfony recipes.

This is what happens when I require a Symfony recipe outside Homestead VM: capture d ecran de 2018-06-01 07-50-32

Actual behavior

Symfony Flex do not seems to be "registered" as composer plugin, and so I can't use short notations to require Symfony recipes.

capture d ecran de 2018-06-01 07-49-09

Steps to reproduce

  1. Login to the VM through SSH
  2. Run composer req maker
  3. The package maker is not found.

When running vagrant up, there is this output at the very end. Is this related?

==> mangatheque: Running provisioner: shell...
    mangatheque: Running: script: Update Composer
    mangatheque: You are running composer as "root", while "/home/vagrant/.composer" is owned by "vagrant"
    mangatheque: You are already using composer version 1.6.5 (stable channel).

Thanks!

browner12 commented 6 years ago

I'm not as familiar with Symfony Flex, but from what I've read, don't you need to be in a project directory that has symfony/flex installed in the composer dependencies for this to work?

I don't believe this is a global feature, but rather a project specific feature.

svpernova09 commented 6 years ago

Homestead does not contain Symfony Flex by default so you would need to install it before usage. I'll see about adding it to https://github.com/laravel/settler

svpernova09 commented 6 years ago

According to https://symfony.com/doc/current/setup/flex.html you should add flex as a dependency in your application's composer.json so I don't believe there's anything to do for Homestead here.

Kocal commented 6 years ago

Well, to be honest I'm not even sure that I am running composer inside the good directory...

I'll tell you that when I'll be at home.

Kocal commented 6 years ago

...

That was actually that. I didn't run composer inside the code directory, I needed to run cd code before...

It's working perfectly now, sorry for wasting your time, thanks!