vagrant reload --provision是错误的说运行作曲家为" root",我该怎么办?

时间:2018-02-02 06:17:31

标签: php vagrant homestead

我使用了vagrant reload --provision,它说:

==> 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

在本报告中,

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).

是红色的,就像错误信息一样。

这是图片:

picture

那么如何修复此错误消息?

2 个答案:

答案 0 :(得分:3)

我是一个真正的新手,但这是我找到的。

首先,本文解释了根本问题(原谅双关语): https://snipe.net/2017/11/15/so-you-ran-composer-as-root/

要解决此问题,我转到终端,访问我用户的顶级文件夹并运行“rm .composer”以删除我之前安装的.composer文件夹。

之后,我跑了“vagrant halt”和“vagrant up”,错误消息消失了,我的网站运行正常。

答案 1 :(得分:0)

提示:在使用Homestead开发时,我尝试通过运行ssh-add.cmd在Homestead机器中运行我所有的作曲家命令。