我对php composer有一个很大的问题,我运行这个命令
php composer.phar install但是它向我显示了这个错误
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-install-cmd event terminated with an exception
[RuntimeException]
An error occurred when executing the "'cache:clear --no-warmup'" command:
PHP Warning: require_once(/var/www/lcp-api/app/bootstrap.php.cache): failed to open stream: No such file or directory in /var/www/lcp-api/app/console on line 10
PHP Fatal error: require_once(): Failed opening required '/var/www/lcp-api/app/bootstrap.php.cache' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/
lcp-api/app/console on line 10
.我检查了文件composer.json,看起来一切正常
"post-install-cmd": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
],
"post-update-cmd": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
]
},你知道为什么我会得到这个错误吗?
诚恳地
发布于 2017-10-02 02:18:26
你的bootstrap.php.cache文件好像不见了。Symfony有时会发生这种情况。
如果运行的是composer update而不是install,则应重新生成该文件。如果这不起作用,您可以通过从项目的根目录运行以下命令来手动生成:
php vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php如果这也不起作用,您可以尝试通过运行composer来强制环境进入生产模式,如下所示:
SYMFONY_ENV=prod composer install请记住,如果在开发环境中执行此操作,调试模式将被禁用。这将生成一个bootstrap.php.cache文件,因此您应该能够再次在开发模式下重新运行composer。
https://stackoverflow.com/questions/46515225
复制相似问题