无法打开流:Homestead环境中没有此类文件或目录

时间:2017-04-18 10:16:04

标签: php laravel composer-php homestead artisan

我正在使用宅基地环境和命令行“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 install

之后的

下一个错误

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$

1 个答案:

答案 0 :(得分:3)

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

此问题的解决方案是插入应该存在的代码(found here)。

文件最终如何丢失并不清楚。