解决homestead报错Command "init" is not defined.

今天配置laravel homestead出现报错信息如下1和2,这是2错误是V2和V3-V4版本命令不同导致的
使用以下命令在zsh加上alias再次执行就没有问题了。

1
2
#alias
alias homestead='function __homestead() { (cd ~/.composer/vendor/laravel/homestead && vagrant $*); unset -f __homestead; }; __homestead'
  • 错误1

    1
    2
    [Symfony\Component\Console\Exception\CommandNotFoundException]
    Command "init" is not defined.
  • 错误2

    1
    2
    3
    4
    5
    6
    PHP Warning:  require(/Users/beorn/Projects/Homestead/../../autoload.php): failed to open stream: No such file or directory in /Users/beorn/Projects/Homestead/homestead on line 7

    Warning: require(/Users/beorn/Projects/Homestead/../../autoload.php): failed to open stream: No such file or directory in /Users/beorn/Projects/Homestead/homestead on line 7
    PHP Fatal error: require(): Failed opening required '/Users/beorn/Projects/Homestead/../../autoload.php' (include_path='.:') in /Users/beorn/Projects/Homestead/homestead on line 7

    Fatal error: require(): Failed opening required '/Users/beorn/Projects/Homestead/../../autoload.php' (include_path='.:') in /Users/beorn/Projects/Homestead/homestead on line 7
感谢老板!