配置Laravel Homestead Vagrant box 啟動服務報錯

來源:互聯網
上載者:User
關鍵字 laravel homestead vagrant bash php

參考https://phphub.org/topics/2
根據上面提示配置,在運行vagrant up 報錯如下:

Administrator@LUHSQLSY0HHQ5J6 MINGW32 /e/home/vagrant/mytwitter$ vagrant upA Vagrant environment or target machine is required to run thiscommand.Run `vagrant init` to create a new Vagrant environment. Or,get an ID of a target machine from `vagrant global-status` to runthis command on. A final option is to change to a directory with aVagrantfile and to try again.

配置清單:

homestead up提示:

C:\Users\Administrator\.homestead>homestead upC:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/psych.rb:370:in `parse': ():did not find expected '-' indicator while parsing a block collection at line 23 column 5 (Psych::SyntaxError)        from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/psych.rb:370:in`parse_stream'        from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/psych.rb:318:in `parse'        from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/psych.rb:245:in `load'        from C:/Users/Administrator/AppData/Roaming/Composer/vendor/laravel/homestead/Vagrantfile:20:in`block in '        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/config/v2/loader.rb:37:in`call'        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/config/v2/loader.rb:37:in`load'        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/config/loader.rb:113:in`block (2 levels) in load'        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/config/loader.rb:107:in`each'        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/config/loader.rb:107:in`block in load'        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/config/loader.rb:104:in`each'        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/config/loader.rb:104:in`load'        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/vagrantfile.rb:28:in`initialize'        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/environment.rb:740:in`new'        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/environment.rb:740:in`vagrantfile'        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/environment.rb:486:in`host'        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/environment.rb:208:in`block in action_runner'        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/action/runner.rb:33:in`call'                   from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/action/runner.rb:33:in`run'        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/environment.rb:473:in`hook'        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/environment.rb:722:in`unload'        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/bin/vagrant:177:in`ensure in '        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/bin/vagrant:177:in`'

回複內容:

參考https://phphub.org/topics/2
根據上面提示配置,在運行vagrant up 報錯如下:

Administrator@LUHSQLSY0HHQ5J6 MINGW32 /e/home/vagrant/mytwitter$ vagrant upA Vagrant environment or target machine is required to run thiscommand.Run `vagrant init` to create a new Vagrant environment. Or,get an ID of a target machine from `vagrant global-status` to runthis command on. A final option is to change to a directory with aVagrantfile and to try again.

配置清單:

homestead up提示:

C:\Users\Administrator\.homestead>homestead upC:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/psych.rb:370:in `parse': ():did not find expected '-' indicator while parsing a block collection at line 23 column 5 (Psych::SyntaxError)        from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/psych.rb:370:in`parse_stream'        from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/psych.rb:318:in `parse'        from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.2.0/psych.rb:245:in `load'        from C:/Users/Administrator/AppData/Roaming/Composer/vendor/laravel/homestead/Vagrantfile:20:in`block in '        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/config/v2/loader.rb:37:in`call'        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/config/v2/loader.rb:37:in`load'        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/config/loader.rb:113:in`block (2 levels) in load'        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/config/loader.rb:107:in`each'        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/config/loader.rb:107:in`block in load'        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/config/loader.rb:104:in`each'        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/config/loader.rb:104:in`load'        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/vagrantfile.rb:28:in`initialize'        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/environment.rb:740:in`new'        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/environment.rb:740:in`vagrantfile'        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/environment.rb:486:in`host'        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/environment.rb:208:in`block in action_runner'        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/action/runner.rb:33:in`call'                   from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/action/runner.rb:33:in`run'        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/environment.rb:473:in`hook'        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/environment.rb:722:in`unload'        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/bin/vagrant:177:in`ensure in '        from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.1/bin/vagrant:177:in`'

vagrant up 需要在 init 的目錄下執行。

我一般的步驟是:

  1. 下載 virtualbox.box 檔案

vagrant box add laravel/homestead

然後選擇 virtualbox , 會自動下載 virtualbox.box , 但是很慢,複製一下地址然後用迅雷或者百度網盤下載。然後再執行一個 add 並指定好路徑

  1. 添加 box

vagrant box add laravel/homestead 
  1. 安裝 homestead

composer global require "laravel/homestead=~2.2"

然後將 ~/.composer/vendor/bin 添加到環境變數

  1. 初始化,並運行

homestead inithomestead edit

設定好共用資料夾,映射的連接埠,然後就可以啦。

homestead up

請問有在 homestead 目錄 vagrant up了嗎

step1: composer require laravel/homestead
step2: ./vendor/bin/homestead make
step3: vagrant up

報錯就有 vagrant init 初始化一下。 我也剛才配好這個東西

根據提示先在目錄下vagrant init初始化,然後再vagrant up啟動

  • 相關文章

    聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.