PHP / Composer无法重新声明 [英] PHP / Composer cannot redeclare

查看:97
本文介绍了PHP / Composer无法重新声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很高兴在开发环境中工作,突然开始出现以下错误:

I was happily working away in my development environment and suddenly I started getting the following error:


PHP致命错误:无法重新声明composerRequire7a368ac394ae1d2e857becf2a235ebaa ()(先前在[APP_ROOT] /vendor/composer/autoload_real.php中在[APP_ROOT] /vendor/composer/autoload_real.php:56中声明)

PHP Fatal error: Cannot redeclare composerRequire7a368ac394ae1d2e857becf2a235ebaa() (previously declared in [APP_ROOT]/vendor/composer/autoload_real.php:56) in [APP_ROOT]/vendor/composer/autoload_real.php on line 59

在作曲家依赖方面我没有做任何改动(尽管我认为我确实在那个时间范围内的某个地方做了了 composer update ,但没有

I haven't made any changes to speak of in composer dependencies (although I think I did do a composer update somewhere in that timeframe but no changes to the dependencies/packages used so nothing big should have changed.

值得注意的是,当我在笔记本电脑上查看存储库时,没有得到此错误,但是如果我 git clone 一个干净的仓库,然后在我的主要开发计算机上安装 composer安装,我确实得到了这个错误,所以我假设是一定有一些特定于机器的起源,但是我对这可能是什么没有足够的想法。

Notably, when I checkout the repo on my laptop I do NOT get this error but if I git clone a clean repo and then composer install on my main development machine I DO get this error. So I'm assuming it must have some machine-specific origin but I'm running out of ideas on what that might be.

任何他


注意:我在OSX上运行PHP 5.3.28;我的应用程序使用命名空间,并且符合PSR0

Note: I'm running PHP 5.3.28 on OSX; my app uses namespacing and is PSR0 compliant






运行PHPUnit 4.0.17,并在尝试运行单元测试的最初阶段触发该错误(与WHICH单元测试无关)。这是堆栈跟踪:


Also of note is that I'm running PHPUnit 4.0.17 and the error is triggered at the very first stages of trying to run a unit test (it doesn't matter WHICH unit test). Here's the stack trace:


0.0009     636648   1. {main}() [APP_BASE]/vendor/phpunit/phpunit/phpunit:0
0.0465    1423664   2. PHPUnit_TextUI_Command::main() [APP_BASE]/vendor/phpunit/phpunit/phpunit:54
0.0465    1424280   3. PHPUnit_TextUI_Command->run() [APP_BASE]/vendor/phpunit/phpunit/src/TextUI/Command.php:132
0.0465    1424280   4. PHPUnit_TextUI_Command->handleArguments() [APP_BASE]/vendor/phpunit/phpunit/src/TextUI/Command.php:141
0.0674    2123344   5. PHPUnit_TextUI_Command->handleBootstrap() [APP_BASE]/vendor/phpunit/phpunit/src/TextUI/Command.php:638
0.0681    2139872   6. PHPUnit_Util_Fileloader::checkAndLoad() [APP_BASE]/vendor/phpunit/phpunit/src/TextUI/Command.php:808
0.0681    2140008   7. PHPUnit_Util_Fileloader::load() [APP_BASE]/vendor/phpunit/phpunit/src/Util/Fileloader.php:77
0.0774    2144176   8. include_once('[APP_BASE]/tests/test-loader.php') [APP_BASE]/vendor/phpunit/phpunit/src/Util/Fileloader.php:93
0.0775    2146736   9. include('[APP_BASE]/vendor/autoload.php') [APP_BASE]/tests/test-loader.php:2



推荐答案

删除编写器。锁定供应商/ ,然后再次运行 composer更新

Delete composer.lock and vendor/ and run composer update again.

这篇关于PHP / Composer无法重新声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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