E:wampwww>composer create-project symfony/framework-standard-edition myproject
当从CMD
运行上述命令时,我得到了以下错误[SymfonyComponentDependencyInjectionExceptionInvalidArgumentException]
$id must be a string, or an Alias object.
Script SensioBundleDistributionBundleComposerScriptHandler::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 'SymfonyComponentDependencyInjectionExceptionInvalidArgumentException' with message '$id must be a string, or an Alias object.' in E:wampwwwjiccvendorsymfonysymfonysrcSymfonyComponentDependencyInjectionContainerBuilder.php on line 684
( ! ) SymfonyComponentDependencyInjectionExceptionInvalidArgumentException: $id must be a string, or an Alias object. in E:wampwwwjiccvendorsymfonysymfonysrcSymfonyComponentDependencyInjectionContainerBuilder.php on line 684
调用堆栈
# Time Memory Function Location
1 0.0006 243936 {main}( ) ..app.php:0
2 0.0168 1858928 SymfonyComponentHttpKernelKernel->handle( ) ..app.php:28
3 0.0168 1859248 SymfonyComponentHttpKernelKernel->boot( ) ..bootstrap.php.cache:2442
4 0.0214 2030936 SymfonyComponentHttpKernelKernel->initializeContainer( ) ..bootstrap.php.cache:2411
5 0.1249 6222584 SymfonyComponentDependencyInjectionContainerBuilder->compile( ) ..bootstrap.php.cache:2633
6 0.1365 6246912 SymfonyComponentDependencyInjectionCompilerCompiler->compile( ) ..ContainerBuilder.php:614
7 0.1365 6252376 SymfonyComponentHttpKernelDependencyInjectionMergeExtensionConfigurationPass->process( ) ..Compiler.php:117
8 0.1367 6253344 SymfonyComponentDependencyInjectionCompilerMergeExtensionConfigurationPass->process( ) ..MergeExtensionConfigurationPass.php:39
9 0.3882 11688728 SymfonyBundleSwiftmailerBundleDependencyInjectionSwiftmailerExtension->load( ) ..MergeExtensionConfigurationPass.php:55
10 0.3993 11915400 SymfonyBundleSwiftmailerBundleDependencyInjectionSwiftmailerExtension->configureMailer( ) ..SwiftmailerExtension.php:53
11 0.3996 11924184 SymfonyBundleSwiftmailerBundleDependencyInjectionSwiftmailerExtension->configureMailerSpool( ) ..SwiftmailerExtension.php:92
12 0.3997 11930016 SymfonyComponentDependencyInjectionContainerBuilder->setAlias( ) ..SwiftmailerExtension.php:223
有人能帮我解决这个问题吗?
如果在新安装Symfony时发生这种情况,请考虑运行稳定且长期支持的Symfony版本,目前为2.7:
composer create-project symfony/framework-standard-edition my_project_name "2.7.*"
如果这对你有用,那么请在symfony/symfony-standard中发布一个bug报告。可能在最新版本中引入了错误
我也遇到了同样的问题。尝试在命令中使用-v switch。"php app/console cache:clear -v"查看回溯。
更多关于我的案例:我把所有参数从参数中移走。yml文件到PHP环境变量,然后有这个问题。基本上SwiftMailer停止查看参数值。使用-v开关,我找到了原因。
更新:
我注意到,如果我清除我的缓存手册,例如使用linux的rm -rf app/cache/*命令,我得到了一个错误。但是,如果我使用app/console cache:clear命令清除缓存,一切工作正常。