【问题标题】:Symfony installation exception in my wamp server我的 wamp 服务器中的 Symfony 安装异常
【发布时间】:2016-03-04 19:28:07
【问题描述】:
E:\wamp\www>composer create-project symfony/framework-standard-edition myproject 

从我的 CMD 运行上述命令时出现以下错误

[Symfony\Component\DependencyInjection\Exception\InvalidArgumentException]
  $id must be a string, or an Alias object.



Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handl
ing the post-install-cmd event terminated with an exception



  [RuntimeException]
  An error occurred when executing the ""cache:clear --no-warmup"" command.



create-project [-s|--stability="..."] [--prefer-source] [--prefer-dist] [--repos
itory-url="..."] [--dev] [--no-dev] [--no-plugins] [--no-custom-installers] [--n
o-scripts] [--no-progress] [--keep-vcs] [--no-install] [--ignore-platform-reqs]
[package] [directory] [version]

当我尝试在浏览器中打开它时,它会显示以下内容

( ! ) Fatal error: Uncaught exception 'Symfony\Component\DependencyInjection\Exception\InvalidArgumentException' with message '$id must be a string, or an Alias object.' in E:\wamp\www\jicc\vendor\symfony\symfony\src\Symfony\Component\DependencyInjection\ContainerBuilder.php on line 684
( ! ) Symfony\Component\DependencyInjection\Exception\InvalidArgumentException: $id must be a string, or an Alias object. in E:\wamp\www\jicc\vendor\symfony\symfony\src\Symfony\Component\DependencyInjection\ContainerBuilder.php on line 684

调用栈

#   Time    Memory  Function    Location
1   0.0006  243936  {main}( )   ..\app.php:0
2   0.0168  1858928 Symfony\Component\HttpKernel\Kernel->handle( )  ..\app.php:28
3   0.0168  1859248 Symfony\Component\HttpKernel\Kernel->boot( )    ..\bootstrap.php.cache:2442
4   0.0214  2030936 Symfony\Component\HttpKernel\Kernel->initializeContainer( ) ..\bootstrap.php.cache:2411
5   0.1249  6222584 Symfony\Component\DependencyInjection\ContainerBuilder->compile( )  ..\bootstrap.php.cache:2633
6   0.1365  6246912 Symfony\Component\DependencyInjection\Compiler\Compiler->compile( ) ..\ContainerBuilder.php:614
7   0.1365  6252376 Symfony\Component\HttpKernel\DependencyInjection\MergeExtensionConfigurationPass->process( )    ..\Compiler.php:117
8   0.1367  6253344 Symfony\Component\DependencyInjection\Compiler\MergeExtensionConfigurationPass->process( )  ..\MergeExtensionConfigurationPass.php:39
9   0.3882  11688728    Symfony\Bundle\SwiftmailerBundle\DependencyInjection\SwiftmailerExtension->load( )  ..\MergeExtensionConfigurationPass.php:55
10  0.3993  11915400    Symfony\Bundle\SwiftmailerBundle\DependencyInjection\SwiftmailerExtension->configureMailer( )   ..\SwiftmailerExtension.php:53
11  0.3996  11924184    Symfony\Bundle\SwiftmailerBundle\DependencyInjection\SwiftmailerExtension->configureMailerSpool( )  ..\SwiftmailerExtension.php:92
12  0.3997  11930016    Symfony\Component\DependencyInjection\ContainerBuilder->setAlias( ) ..\SwiftmailerExtension.php:223

有人可以帮我解决这个问题吗?

【问题讨论】:

  • 清项目缓存失败,没那么重要。我认为您的项目现在已经准备好并安装了,我错了吗?
  • @soroush gholamzadeh 是的,这是真的。项目已成功运行。感谢您的快速响应
  • 欢迎您,但是考虑到每当您要清除缓存时,由于此错误,您应该手动清除它,希望其他人帮助您解决此问题
  • @sorush gholamzadeh。请忽略我之前的评论。在浏览器中打开项目时出现致命错误。请再次回答这个问题。查找浏览器输出
  • 什么? NO,如果清除缓存异常失败,那就不行了。

标签: symfony


【解决方案1】:

如果在全新安装 Symfony 时出现这种情况,请考虑运行稳定且长期受支持的 Symfony 版本,目前为 2.7:

composer create-project symfony/framework-standard-edition my_project_name "2.7.*"

如果这对您有用,请在symfony/symfony-standard 中发布错误报告。可能是在最新版本中引入了一个错误。

【讨论】:

  • 按照您的建议,我尝试了其他一些标准版本(2.7.1、2.7.2 和 2.7.5)但未能成功。
  • @siva:和以前一样的错误?还是其他问题?
  • 面临同样的异常。
【解决方案2】:

我遇到了同样的问题。尝试将 -v 开关与您的命令一起使用,例如"php app/console cache:clear -v" 查看回溯。

更多关于我的案例: 我将所有参数从 parameters.yml 文件移动到 PHP 环境变量,然后遇到了这个问题。基本上 SwiftMailer 停下来查看参数值。使用 -v 开关,我找到了原因。

更新:

我注意到,如果我清除缓存手册,例如使用 linux 的 rm -rf app/cache/* 命令,我得到了错误。但如果我使用 app/console cache:clear 命令清除缓存,一切正常。

【讨论】:

    猜你喜欢
    • 2016-12-09
    • 2018-02-12
    • 2013-07-04
    • 1970-01-01
    • 2018-07-07
    • 2015-04-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多