首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >PHP composer安装问题

PHP composer安装问题
EN

Stack Overflow用户
提问于 2017-10-02 01:56:21
回答 1查看 589关注 0票数 0

我对php composer有一个很大的问题,我运行这个命令

代码语言:javascript
复制
php composer.phar install

但是它向我显示了这个错误

代码语言:javascript
复制
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,看起来一切正常

代码语言:javascript
复制
"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"
    ]
  },

你知道为什么我会得到这个错误吗?

诚恳地

EN

回答 1

Stack Overflow用户

发布于 2017-10-02 02:18:26

你的bootstrap.php.cache文件好像不见了。Symfony有时会发生这种情况。

如果运行的是composer update而不是install,则应重新生成该文件。如果这不起作用,您可以通过从项目的根目录运行以下命令来手动生成:

代码语言:javascript
复制
php vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php

如果这也不起作用,您可以尝试通过运行composer来强制环境进入生产模式,如下所示:

代码语言:javascript
复制
SYMFONY_ENV=prod composer install

请记住,如果在开发环境中执行此操作,调试模式将被禁用。这将生成一个bootstrap.php.cache文件,因此您应该能够再次在开发模式下重新运行composer。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46515225

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档