Chess
Chess

Reputation: 23

vagrant reload --provision is wrong says running composer as "root",how can I do?

I used vagrant reload --provision, it says:

==> homestead-7: Attempting graceful shutdown of VM...
==> homestead-7: Checking if box 'laravel/homestead' is up to date...
==> homestead-7: Clearing any previously set forwarded ports...
==> homestead-7: Fixed port collision for 80 => 8000. Now on port 2200.
==> homestead-7: Clearing any previously set network interfaces...
==> homestead-7: Preparing network interfaces based on configuration...
    homestead-7: Adapter 1: nat
    homestead-7: Adapter 2: hostonly
==> homestead-7: Forwarding ports...
    homestead-7: 80 (guest) => 2200 (host) (adapter 1)
    homestead-7: 443 (guest) => 44300 (host) (adapter 1)
    homestead-7: 3306 (guest) => 33060 (host) (adapter 1)
    homestead-7: 4040 (guest) => 4040 (host) (adapter 1)
    homestead-7: 5432 (guest) => 54320 (host) (adapter 1)
    homestead-7: 8025 (guest) => 8025 (host) (adapter 1)
    homestead-7: 27017 (guest) => 27017 (host) (adapter 1)
    homestead-7: 22 (guest) => 2222 (host) (adapter 1)
==> homestead-7: Running 'pre-boot' VM customizations...
==> homestead-7: Booting VM...
==> homestead-7: Waiting for machine to boot. This may take a few minutes...
    homestead-7: SSH address: 127.0.0.1:2222
    homestead-7: SSH username: vagrant
    homestead-7: SSH auth method: private key
    homestead-7: Warning: Connection reset. Retrying...
    homestead-7: Warning: Remote connection disconnect. Retrying...
    homestead-7: Warning: Connection reset. Retrying...
    homestead-7: Warning: Remote connection disconnect. Retrying...
    homestead-7: Warning: Connection reset. Retrying...
    homestead-7: Warning: Remote connection disconnect. Retrying...
==> homestead-7: Machine booted and ready!
==> homestead-7: Checking for guest additions in VM...
    homestead-7: The guest additions on this VM do not match the installed version of
    homestead-7: VirtualBox! In most cases this is fine, but in rare cases it can
    homestead-7: prevent things such as shared folders from working properly. If you see
    homestead-7: shared folder errors, please make sure the guest additions within the
    homestead-7: virtual machine match the version of VirtualBox you have installed on
    homestead-7: your host and reload your VM.
    homestead-7: 
    homestead-7: Guest Additions Version: 5.0.18_Ubuntu r106667
    homestead-7: VirtualBox Version: 5.2
==> homestead-7: Setting hostname...
==> homestead-7: Configuring and enabling network interfaces...
==> homestead-7: Mounting shared folders...
    homestead-7: /vagrant => /Users/imchess/Homestead
    homestead-7: /home/vagrant/code => /www/Code/php
==> homestead-7: Running provisioner: file...
==> homestead-7: Running provisioner: shell...
    homestead-7: Running: inline script
==> homestead-7: Running provisioner: shell...
    homestead-7: Running: inline script
==> homestead-7: Running provisioner: shell...
    homestead-7: Running: inline script
==> homestead-7: Running provisioner: shell...
    homestead-7: Running: /var/folders/hq/czdzwx2n1c3_mzsf4vfwm8gm0000gn/T/vagrant-shell20180202-16576-1j9ra42.sh
==> homestead-7: Running provisioner: shell...
    homestead-7: Running: script: Creating Certificate: mwboom.local
==> homestead-7: Running provisioner: shell...
    homestead-7: Running: script: Creating Site: mwboom.local
==> homestead-7: Running provisioner: shell...
    homestead-7: Running: inline script
==> homestead-7: Running provisioner: shell...
    homestead-7: Running: script: Checking for old Schedule
==> homestead-7: Running provisioner: shell...
    homestead-7: Running: script: Creating Certificate: slboom.local
==> homestead-7: Running provisioner: shell...
    homestead-7: Running: script: Creating Site: slboom.local
==> homestead-7: Running provisioner: shell...
    homestead-7: Running: inline script
==> homestead-7: Running provisioner: shell...
    homestead-7: Running: script: Checking for old Schedule
==> homestead-7: Running provisioner: shell...
    homestead-7: Running: script: Clear Variables
==> homestead-7: Running provisioner: shell...
    homestead-7: Running: script: Restarting Cron
==> homestead-7: Running provisioner: shell...
    homestead-7: Running: script: Restarting Nginx
==> homestead-7: Running provisioner: shell...
    homestead-7: Running: script: Creating MySQL Database: homestead
==> homestead-7: Running provisioner: shell...
    homestead-7: Running: script: Creating Postgres Database: homestead
==> homestead-7: Running provisioner: shell...
    homestead-7: Running: script: Update Composer
    homestead-7: You are running composer as "root", while "/home/vagrant/.composer" is owned by "vagrant"
    homestead-7: You are already using composer version 1.6.3 (stable channel).
==> homestead-7: Running provisioner: shell...
    homestead-7: Running: /var/folders/hq/czdzwx2n1c3_mzsf4vfwm8gm0000gn/T/vagrant-shell20180202-16576-17qinoh.sh
==> homestead-7: Running provisioner: shell...
    homestead-7: Running: /var/folders/hq/czdzwx2n1c3_mzsf4vfwm8gm0000gn/T/vagrant-shell20180202-16576-i3q6nl.sh

In this report,

homestead-7: You are running composer as "root", while "/home/vagrant/.composer" is owned by "vagrant"
homestead-7: You are already using composer version 1.6.3 (stable channel).

is red, like an error message.

This is the picture:

picture

So how can I fix this error message?

Upvotes: 2

Views: 4759

Answers (2)

mike
mike

Reputation: 1906

TIP: When I'm developing with Homestead I try to run all of my composer commands in the Homestead machine by running vagrant ssh.

Upvotes: 0

Mike Taverne
Mike Taverne

Reputation: 9352

I'm a real newbie at this, but here is what I found.

First, this article explains the root issue (forgive the pun): https://snipe.net/2017/11/15/so-you-ran-composer-as-root/

To fix the issue, I went to Terminal, to my user's top-level folder and ran "rm .composer" to remove the .composer folder that I had previously installed.

After that, I ran "vagrant halt" and "vagrant up" and the error message was gone, and my site ran properly.

Upvotes: 3

Related Questions