php artisan在编译视图时优化错误

时间:2014-09-07 23:12:04

标签: php laravel laravel-4

版本: Laravel:4.3-dev。
运行此命令后:php artisan optimize -vvv出现以下错误:

Generating optimized class loader
Compiling common classes
Compiling views



  [ErrorException]                                                                                                                                                   
  file_put_contents(/path/to/laravel/project/app/storage/views/acdf854d7379225870611046cb29be6f): failed to open stream: No such file or directory  



Exception trace:
 () at /path/to/laravel/project/storage/meta/compiled.php:4529
 Illuminate\Exception\Handler->handleError() at n/a:n/a
 file_put_contents() at /path/to/laravel/project/storage/meta/compiled.php:4529
 Illuminate\Filesystem\Filesystem->put() at /path/to/laravel/project/vendor/laravel/framework/src/Illuminate/View/Compilers/BladeCompiler.php:80
 Illuminate\View\Compilers\BladeCompiler->compile() at /path/to/laravel/project/vendor/laravel/framework/src/Illuminate/Foundation/Console/OptimizeCommand.php:150
 Illuminate\Foundation\Console\OptimizeCommand->compileViews() at /path/to/laravel/project/vendor/laravel/framework/src/Illuminate/Foundation/Console/OptimizeCommand.php:71
 Illuminate\Foundation\Console\OptimizeCommand->fire() at /path/to/laravel/project/vendor/laravel/framework/src/Illuminate/Console/Command.php:112
 Illuminate\Console\Command->execute() at /path/to/laravel/project/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:252
 Symfony\Component\Console\Command\Command->run() at /path/to/laravel/project/vendor/laravel/framework/src/Illuminate/Console/Command.php:100
 Illuminate\Console\Command->run() at /path/to/laravel/project/vendor/symfony/console/Symfony/Component/Console/Application.php:891
 Symfony\Component\Console\Application->doRunCommand() at /path/to/laravel/project/vendor/symfony/console/Symfony/Component/Console/Application.php:195
 Symfony\Component\Console\Application->doRun() at /path/to/laravel/project/vendor/symfony/console/Symfony/Component/Console/Application.php:126
 Symfony\Component\Console\Application->run() at /path/to/laravel/project/artisan:59


optimize [--force] [--psr]

错误显示视图编译器尝试将文件保存在存储file_put_contents(/path/to/laravel/project/app/storage/views/acdf854d7379225870611046cb29be6f)文件夹中,但是使用新的Laravel文件夹结构,存储文件夹不在app文件夹下,但优化器仍然引用旧文件夹来自Laravel 4.2的路径,当该行应为file_put_contents(/path/to/laravel/project/storage/views/acdf854d7379225870611046cb29be6f)时,我该如何解决?

更新

顺便说一下,我安装了mcrypt扩展程序 删除compiled.php文件并未修复错误 删除供应商目录并运行composer install没有帮助。

更新2:

laravel 4.3的新文件夹结构的存储目录与app目录处于同一级别,优化器在到达compiling view步骤时失败并出现failed to open stream: No such file or directory错误,因为artizan优化器尝试保存查看app目录下存储下的视图文件,而不是在同一级别 这发生在一个新的laravel安装中,我还没有开始编码。

1 个答案:

答案 0 :(得分:1)

我不建议从4.2升级到4.3它仍然处于早期测试阶段,并且有传言称Taylor将以5.0的形式发布它,因为升级后所有的重组和破坏性更改。

尝试创建一个新的laravel 4.3项目,然后将代码复制到新安装中。请记住,整个应用程序现在都是命名空间,包括控制器,因此这需要为所有现有代码和类添加名称空间。