在symfony中使用Composer安装--no-dev时出现ClassNotFoundError。

问题描述 投票:-2回答:1

我想把我的symfony项目上传到服务器上,但传到开发版时却出现了这个错误。

composer install --no-dev --optimize-autoloader

PS C:\Users\adria\Desktop\bebeBB>  composer install --no-dev --optimize-autoloader
Loading composer repositories with package information
Installing dependencies from lock file
Nothing to install or update
Generating optimized autoload files
ocramius/package-versions: Generating version class...
ocramius/package-versions: ...done generating version class
51 packages you are using are looking for funding.
Use the composer fund command to find out more!   
Executing script cache:clear [KO]
 [KO]
Script cache:clear returned with error code 255
!!  Symfony\Component\ErrorHandler\Error\ClassNotFoundError {#33
!!    #message: """
!!      Attempted to load class "MakerBundle" from namespace "Symfony\Bundle\MakerBundle".\n
!!      Did you forget a "use" statement for another namespace?
!!      """
!!    #code: 0
!!    #file: "C:\Users\adria\Desktop\bebeBB\src\Kernel.php"
!!    #line: 23
!!    trace: {
!!      C:\Users\adria\Desktop\bebeBB\src\Kernel.php:23 {
!!        App\Kernel->registerBundles(): iterable
!!        › if ($envs[$this->environment] ?? $envs['all'] ?? true) {
!!        ›     yield new $class();
!!        › }
!!      }
!!      C:\Users\adria\Desktop\bebeBB\vendor\symfony\http-kernel\Kernel.php:369 { …}
!!      C:\Users\adria\Desktop\bebeBB\vendor\symfony\http-kernel\Kernel.php:123 { …}
!!      C:\Users\adria\Desktop\bebeBB\vendor\symfony\framework-bundle\Console\Application.php:168 { …}
!!      C:\Users\adria\Desktop\bebeBB\vendor\symfony\framework-bundle\Console\Application.php:74 { …}
!!      C:\Users\adria\Desktop\bebeBB\vendor\symfony\console\Application.php:140 { …}
!!      C:\Users\adria\Desktop\bebeBB\bin\console:42 { …}
!!    }
!!  }
!!
Script @auto-scripts was called via post-install-cmd

在Symfony文档中说要运行 export APP_ENV = prod 但它让我,术语 "导出 "不承认作为一个cmdlet的名称。

php symfony deployment symfony4
1个回答
-1
投票

检查你的文件.env:必须是:APP_ENV=prod。

所以,请确保你的环境必须是PROD模式。

© www.soinside.com 2019 - 2024. All rights reserved.