克隆了未安装Git供应商的Symfony项目 [英] Symfony project cloned with git vendors not installed

查看:175
本文介绍了克隆了未安装Git供应商的Symfony项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始了我的一个Fedora客人的symfony项目并开发了好几次。然后,我已经将我的文件导出到亚马逊EC2虚拟机,感谢koding.com并在那里编码了一段时间(这很方便)。我终于希望能够从任何环境编写代码,所以我设置了git并将所有文件保存在那里。



昨天,我从github中将我的存储库克隆到我的Fedora并试图启动它。它不适用于一些供应商库没有安装。



我已经阅读了文档,这是正常的,在克隆一个存储库之后必须做一个php composer.phar install。



我试过了,但我收到一条错误消息,因为供应商库在我的AppKernel中声明

  php composer.phar install 
使用包信息加载composer存储库
从锁定文件
安装依赖项(包括require-dev)安装或更新
生成自动加载文件
更新app / config / parameters.yml文件
PHP致命错误:在'home / home / eagle1 / www / ICORECO / app / AppKernel.php第29行

所以我尝试评论这些行,但显然,我得到的代码扩展了这个类,所以再次作曲家安装会产生一个错误。

  php composer.phar install 
加载作曲家repositori es带包信息
从锁文件安装依赖项(包括require-dev)
无需安装或更新
生成自动加载文件
更新app / config / parameters.yml文件[LogicException]
BundleNRtworksSubscriptionBundle扩展了未注册的FOSUserBundle包。

我该怎么办?

是我的.gitignore

 #缓存和日志(Symfony2)
/ app / cache / *
/ app / logs / *
!app / cache / .gitkeep
!app / logs / .gitkeep
#缓存和日志(Symfony3)
/ var / cache / *
/ var / logs / *
!var / cache / .gitkeep
!var / logs / .gitkeep
#参数
/app/config/parameters.yml
/app/config/parameters.ini
#由Composer管理
/app/bootstrap.php.cache
/var/bootstrap.php.cache
/ bin / *
!bin / console
!bin / symfony_requirements
/ vendor /
#资产和用户上传
/ web / bundles /
/ web / uploads /
#PHPUnit
/app/phpunit.xml
/phpunit.xml
#构建数据
/ build /
#Composer PHAR


解决方案

听起来像 vendor / 目录处于不一致状态。



一般来说,作曲家建议不要版本控制 vendor / 。您的 composer.json composer.lock 文件都应该被提交,Composer可以编译 vendor / vendor / 并运行作曲家安装

/ code>再次从头开始重建。假设 composer.json composer.lock 是正确的,这会让你回到工作状态。 p>

然后确保你忽略 vendor / ,例如如$ / $>

 供应商/ 

$您的 .gitignore 中的b
$ b

,并移除任何可能意外提交到存储库的供应商文件:

  git rm --cached -r vendor 


I started my symfony project on a Fedora guest and coded happily for several time. Then I've exported my file to an amazon EC2 VM thanks to koding.com and coded there for some time (it's handy). I finally would like to be able to code from any environment so I set up git and have all my files there.

Yesterday, I cloned my repository from github into my Fedora guest and tried to launch it. It doesn't work for some vendors library aren't installed.

I've read the doc and that would be normal, after cloning a repository one has to do a php composer.phar install.

I've tried but I get an error message because the vendors libraries are declare in my AppKernel

php composer.phar install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating autoload files
Updating the "app/config/parameters.yml" file
PHP Fatal error:  Class 'FOS\UserBundle\FOSUserBundle' not found in /home/eagle1/www/ICORECO/app/AppKernel.php on line 29

so I tried commenting these lines but obviously I got code that extends this classes so again composer install generates an error

php composer.phar install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating autoload files
Updating the "app/config/parameters.yml" file                                                                                          [LogicException]                                                                              
  Bundle "NRtworksSubscriptionBundle" extends bundle "FOSUserBundle", which is not registered.  

what can I do ?

This is my .gitignore

# Cache and logs (Symfony2)
/app/cache/*
/app/logs/*
!app/cache/.gitkeep
!app/logs/.gitkeep
# Cache and logs (Symfony3)
/var/cache/*
/var/logs/*
!var/cache/.gitkeep
!var/logs/.gitkeep
# Parameters
/app/config/parameters.yml
/app/config/parameters.ini
# Managed by Composer
/app/bootstrap.php.cache
/var/bootstrap.php.cache
/bin/*
!bin/console
!bin/symfony_requirements
/vendor/
# Assets and user uploads
/web/bundles/
/web/uploads/
# PHPUnit
/app/phpunit.xml
/phpunit.xml
# Build data
/build/
# Composer PHAR

解决方案

It sounds like your vendor/ directory is in an inconsistent state.

In general, Composer recommends not versioning vendor/. Your composer.json and composer.lock files should both be committed, and Composer can build vendor/ from these files.

I recommend deleting vendor/ and running composer install again to rebuild it from scratch. Assuming that composer.json and composer.lock are correct, this should get you back to a working state.

Then makes sure that you are ignoring vendor/, e.g. with a line such as

vendor/

in your .gitignore, and remove any vendor files that may have been accidentally committed to the repository:

git rm --cached -r vendor

这篇关于克隆了未安装Git供应商的Symfony项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆