无法打开流:Homestead 环境中没有这样的文件或目录

failed to open stream: No such file or directory on Homestead environment

我正在使用 homestead 环境和命令行 "php artisan -V" 它不起作用。我用 "laravel new test" 创建了我的项目,所以..我想我的所有文件都已更新。

vagrant@homestead:~/Laracasts/test$ php artisan -V
PHP Warning:  require(/home/vagrant/Laracasts/test/bootstrap/autoload.php):         
failed to open stream: No such file or directory in         
/home/vagrant/Laracasts/test/artisan on line 16

Warning: require(/home/vagrant/Laracasts/test/bootstrap/autoload.php):     
failed to open stream: No such file or directory in 
/home/vagrant/Laracasts/test/artisan on line 16
PHP Fatal error:  require(): Failed opening required 
'/home/vagrant/Laracasts/test/bootstrap/autoload.php' 
(include_path='.:/usr/share/php') in /home/vagrant/Laracasts/test/artisan on 
line 16

Fatal error: require(): Failed opening required 
'/home/vagrant/Laracasts/test/bootstrap/autoload.php' 
(include_path='.:/usr/share/php') in /home/vagrant/Laracasts/test/artisan on 
line 16
vagrant@homestead:~/Laracasts/test$

.yaml 文件


ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox

authorize: ~/.ssh/id_rsa.pub

keys:
- ~/.ssh/id_rsa

folders:
- map: ~/Desktop/Arnau/dev/repositories/phpmyadmin
  to: /home/vagrant/phpmyadmin

- map: ~/Desktop/Arnau/dev/repositories/Laravel
  to: /home/vagrant/Laravel

- map: ~/Desktop/Arnau/dev/repositories/Laracasts
  to: /home/vagrant/Laracasts

sites:
- map: phpmyadmin.app
  to: /home/vagrant/phpmyadmin

- map: administracio.dev
  to: /home/vagrant/Laravel/administracio/public

- map: laracasts.dev
  to: /home/vagrant/Laravel/laracasts/public

databases:
- phpmyadmin
- administracio
- laracasts

还有..甚至是我在最后添加的主机文件。

192.168.10.10 administracio.dev
192.168.10.10 laracasts.dev

php composer.phar 安装后的下一个错误

vagrant@homestead:~/Laracasts/test$ php composer.phar install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postInstall
> php artisan optimize
PHP Warning:  require(/home/vagrant/Laracasts/test/bootstrap/autoload.php):     
failed to open stream: No such file or directory in     
/home/vagrant/Laracasts/test/artisan on line 16

Warning: require(/home/vagrant/Laracasts/test/bootstrap/autoload.php): 
failed to open stream: No such file or directory in 
/home/vagrant/Laracasts/test/artisan on line 16
PHP Fatal error:  require(): Failed opening required 
'/home/vagrant/Laracasts/test/bootstrap/autoload.php' 
(include_path='.:/usr/share/php') in /home/vagrant/Laracasts/test/artisan on 
line 16

Fatal error: require(): Failed opening required     
'/home/vagrant/Laracasts/test/bootstrap/autoload.php' 
(include_path='.:/usr/share/php') in /home/vagrant/Laracasts/test/artisan on 
line 16
Script php artisan optimize handling the post-install-cmd event returned 
with error code 255
vagrant@homestead:~/Laracasts/test$

经过长时间的讨论和调试,问题变得清晰; bootstrap/autoload.php 文件丢失。

此问题的解决方案是插入本应存在的代码 (found in bootstrap/autoload.php here)。

文件最终丢失的原因尚不清楚。