简体   繁体   English

使用Composer在本地安装symfony2供应商时出错

[英]Error installing symfony2 vendors locally with composer

I hope I have phrased that correctly, but I am trying to install vendors into my symfony2 project, which I have just downloaded from SVN, but I keep getting this error, 我希望我已经正确地说明了这一点,但是我正在尝试将供应商安装到我刚刚从SVN下载的symfony2项目中,但是仍然出现此错误,

  [Symfony\Component\Config\Exception\FileLoaderLoadException]                                                                        
  Cannot import resource "parameters.ini" from "/Users/john/Sites/trunk/awesome/app/zone/config/../../config/config.yml".  

  [InvalidArgumentException]                                                                                                 
  The file "parameters.ini" does not exist (in: /Users/john/Sites/trunk/awesome/app/zone/config/../../config, ).  

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.  

Obviously it seems to be looking in the wrong directory, but I am not sure what file is pointing to those files. 显然,它似乎在错误的目录中查找,但是我不确定哪个文件指向这些文件。

Also, I am quite new to Symfony, so I am unsure of where to look to start fixing the problem... 另外,我对Symfony还是很陌生,所以我不确定从哪里开始解决该问题...

I suppose that you have something like this into app/config/config.yml 我想你在app/config/config.yml

imports:
    - { resource: parameters.ini }

And you haven't parameters.ini file 而且您没有parameters.ini文件

The parameters.ini file is used into Symfony 2.0 and now, in Symfony 2.1 (if you use composer,I suppose that you use Symfony 2.1) this file in turned into parameters.yml so please check for this "error" and try again parameters.ini文件已用于Symfony 2.0,现在,在Symfony 2.1(如果您使用作曲家,我想您使用的是Symfony 2.1)中,此文件已转换为parameters.yml因此请检查此“错误”,然后重试

I'm guessing parameters.ini file wasn't put into your repository as it stores sensitive data (like database password). 我猜想parameters.ini文件没有放到您的存储库中,因为它存储了敏感数据(例如数据库密码)。

You should create it locally. 您应该在本地创建它。 Some people put template files into the repository, so look for files named like parameters.ini.dist . 有人将模板文件放入存储库中,因此寻找名为parameters.ini.dist类的文件。 If there's no such file grab the original file from symfony standard edition and adapt it to your environment. 如果没有这样的文件,请从symfony标准版中获取原始文件,并将其适应您的环境。

As others pointed out, Symfony 2.1 uses parameters.yml instead of parameters.ini by default . 正如其他人指出的那样,Symfony 2.1 默认情况下使用parameters.yml而不是parameters.ini You can still use ini file if you want though. 如果需要,您仍然可以使用ini文件。 If you have a parameters.yml file or want to start using it, follow instructions given in other answers. 如果您有一个parameters.yml文件或想要开始使用它,请按照其他答案中给出的说明进行操作。

我通过删除vendor目录来解决此问题,并再次运行composer install

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM