2015-09-07 139 views
1

運行此composer require intervention/image拋出這個錯誤:作曲家依賴衝突

Using version ^2.3 for intervention/image 
./composer.json has been updated 
Loading composer repositories with package information 
Updating dependencies (including require-dev) 
Your requirements could not be resolved to an installable set of packages. 

Problem 1 
- Conclusion: don't install intervention/image 2.3.1 
- Conclusion: don't install intervention/image 2.3.2 
- Installation request for intervention/image ^2.3 -> satisfiable by intervention/image[2.3.0, 2.3.1, 2.3.2]. 
- intervention/image 2.3.0 requires guzzlehttp/psr7 ~1.1 -> satisfiable by guzzlehttp/psr7[1.1.0, 1.2.0]. 
- guzzlehttp/psr7 1.1.0 requires psr/http-message ~1.0 -> satisfiable by psr/http-message[1.0]. 
- guzzlehttp/psr7 1.2.0 requires psr/http-message ~1.0 -> satisfiable by psr/http-message[1.0]. 
- Conclusion: don't install psr/http-message 1.0 


Installation failed, reverting ./composer.json to its original content. 

所以它是由暴食引起的(我使用"guzzlehttp/guzzle": "~5.3")。但是我不能(或者不想)將guzzle更新爲6.0,因爲它不是向後兼容的,所以我必須移動很多代碼。我能做些什麼,比如訣竅嗎,還是必須更新guzzlehttp/guzzleintervention/image

+0

你的依賴在你的主應用上使用Guzzle嗎?如果他們指定兩個不同版本的Guzzle,你可能會遇到這個問題。 – Zarathuztra

回答

3

使用別名方法有一個嚴重的缺點:它不起作用!

我懷疑你對Guzzle 5的使用是你留言的原因,但對於更多的調查,我需要你的composer.json的內容,也可能是你的composer.lock文件。

這裏添加的依賴不是太複雜。 intervention/image取決於guzzlehttp/psr7 ~1.1,這取決於psr/http-message ~1.0。 Guzzle軟件包是一個全新的軟件包,並沒有與之前版本的Guzzle 5.x一起使用,PSR軟件包也不會與任何內容相沖突 - 但這正是Composer所發現的。但是,在Composer中解密SAT求解器的錯誤消息並不容易。求解器可以輕鬆地爲您創建適用於所有需求的解決方案,但查明故障非常困難。如果可能的話,作曲家會爲你做。

有一個工具,可以幫助人類調試這樣的情況:https://packagist.org/packages/clue/graph-composer

這是一個命令行工具,最好用composer global require clue/graph-composer安裝,並且它也需要「graphviz的」安裝。在你現有的項目中使用它將會揭示當前存在的所有包依賴關係,並且可能會給你一些線索可能是錯誤的。

+0

謝謝!這個反應確實有幫助,它很清楚和精確。無論如何,我切換到以前的干預/圖像版本,在我的項目中使用最新版本並不重要。非常感謝! –

+0

@Sven謝謝你指出「線索/圖形作曲家」。它是Composer依賴關係可視化的一個很好的工具。你知道有相同的工具,但沒有沉重的「graphviz」依賴嗎? –

+0

我認爲目前沒有任何產品能夠像Graphviz那樣繪製圖表 - 至少不是在開源領域。關於如何繪製事物的許多知識都進入了該軟件,因此可能並不是那麼容易進行替換。另一方面,我沒有將它安裝在幾個平臺(即Linux和Windows)上的嚴重問題,並將其提供給圖形編輯器軟件包。 – Sven

0

是的。您可以嘗試使用aliases。 這可能是這樣的:

"guzzlehttp/guzzle": "~5.3 as 6.0"

+1

這是一個竅門,但它不會工作。你可以看看@Sven的回答 –

+0

好的,謝謝。我爲我做了一個筆記。 –

0

您可以使用別名來欺騙作曲,以爲狂飲的是V5.3.0實際上是V6.0。

定義"guzzlehttp/guzzle": "~5.3 as 6.0"將不起作用,因爲這只是一個無效的字符串。你必須要具體說明的版本,並插入5.3.0,就像這樣:

composer.json

{ 
    "require": { 
     "intervention/image": "^2.3", 
     "guzzlehttp/guzzle": "5.3.0 as 6.0" 
    } 
} 

你也可以更新你的代碼guzzlehttp/guzzle V6的工作,但是這可能不是改變幾個字符更多的工作在composer.json中。 )


It's a trick but it won't work. You can have a look at @Sven answer.

它相當明顯,你沒考什麼我張貼。別名版本是完成它的一種方法。它不是解決所有依賴性問題的聖盃。它是解決版本衝突的簡單方法。

[50.2MB/9.02s] - Installing react/promise (v2.2.1) 
[50.6MB/9.07s] Reading C:/Users/koch/AppData/Local/Composer/files/react/promise/3b6fca09c7d57fa8867c8dbe1abf648627.zip from cache 
[50.6MB/9.08s]  Loading from cache 
[50.6MB/9.08s]  Extracting archive 
[50.7MB/9.47s] 
[50.7MB/9.48s]  REASON: guzzlehttp/ringphp 1.1.0 requires react/promise ~2.0 -> satisfiable by react/promise[v2.0.0, v2.1.0, v2.2.0, v2.2.1]. 
[50.7MB/9.48s] 
[50.7MB/9.49s] - Installing guzzlehttp/streams (3.0.0) 
[50.7MB/9.53s] Reading C:/Users/koch/AppData/Local/Composer/files/guzzlehttp/streams/47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5.zip from cache 
[50.7MB/9.54s]  Loading from cache 
[50.7MB/9.54s]  Extracting archive 
[50.7MB/9.92s] 
[50.7MB/9.93s]  REASON: guzzlehttp/ringphp 1.1.0 requires guzzlehttp/streams ~3.0 -> satisfiable by guzzlehttp/streams[3.0.0]. 
[50.7MB/9.93s] 
[50.7MB/9.94s] - Installing guzzlehttp/ringphp (1.1.0) 
[50.7MB/10.01s] Reading C:/Users/koch/AppData/Local/Composer/files/guzzlehttp/ringphp/dbbb91d7f6c191e5e405e900e3102ac7f261bc0b.zip from cache 
[50.7MB/10.02s]  Loading from cache 
[50.7MB/10.02s]  Extracting archive 
[50.7MB/10.41s] 
[50.7MB/10.41s]  REASON: guzzlehttp/guzzle 5.3.0 requires guzzlehttp/ringphp ^1.1 -> satisfiable by guzzlehttp/ringphp[1.1.0]. 
[50.7MB/10.41s] 
[50.7MB/10.43s] - Installing guzzlehttp/guzzle (5.3.0) 
[50.7MB/10.49s] Reading C:/Users/koch/AppData/Local/Composer/files/guzzlehttp/guzzle/f3c8c22471cb55475105c14769644a49c3262b93.zip from cache 
[50.7MB/10.51s]  Loading from cache 
[50.7MB/10.51s]  Extracting archive 
[50.7MB/11.66s] 
[50.7MB/11.66s]  REASON: Required by root: Install command rule (install guzzlehttp/guzzle 5.3.0) 
[50.7MB/11.66s] 
[50.7MB/11.69s] - Installing psr/http-message (1.0) 
[50.7MB/11.77s] Reading C:/Users/koch/AppData/Local/Composer/files/psr/http-message/85d63699f0dbedb190bbd4b0d2b9dc707ea4c298.zip from cache 
[50.7MB/11.78s]  Loading from cache 
[50.7MB/11.78s]  Extracting archive 
[50.7MB/11.91s] 
[50.7MB/11.91s]  REASON: guzzlehttp/psr7 1.2.0 requires psr/http-message ~1.0 -> satisfiable by psr/http-message[1.0]. 
[50.7MB/11.91s] 
[50.7MB/11.94s] - Installing guzzlehttp/psr7 (1.2.0) 
[50.7MB/11.98s] Reading C:/Users/koch/AppData/Local/Composer/files/guzzlehttp/psr7/4ef919b0cf3b1989523138b60163bbcb7ba1ff7e.zip from cache 
[50.7MB/11.98s]  Loading from cache 
[50.7MB/11.98s]  Extracting archive 
[50.7MB/12.61s] 
[50.7MB/12.61s]  REASON: intervention/image 2.3.2 requires guzzlehttp/psr7 ~1.1 -> satisfiable by guzzlehttp/psr7[1.1.0, 1.2.0]. 
[50.7MB/12.61s] 
[50.7MB/12.64s] - Installing intervention/image (2.3.2) 
[50.7MB/12.73s] Reading C:/Users/koch/AppData/Local/Composer/files/intervention/image/1124ff3c6298f0dcf9edf9156623904d7a5c3428.zip from cache 
[50.7MB/12.74s]  Loading from cache 
[50.7MB/12.74s]  Extracting archive 
[50.7MB/14.72s] 
[50.7MB/14.72s]  REASON: Required by root: Install command rule (install intervention/image 2.3.0|install intervention/image 2.3.1|install intervention/image 2.3.2) 
[50.7MB/14.72s] 
[50.3MB/15.09s] intervention/image suggests installing ext-gd (to use GD library based image processing.) 
[50.3MB/15.10s] intervention/image suggests installing ext-imagick (to use Imagick based image processing.) 
[50.3MB/15.11s] intervention/image suggests installing intervention/imagecache (Caching extension for the Intervention Image library) 
[50.4MB/15.17s] Writing lock file 
+0

這是一個技巧,但它不會工作。你可以看看@Sven的答案 –

+0

看來你沒有測試它:)讓我們將這個composer.json作爲事實的依據......我添加了安裝日誌。無論如何..很高興你解決了這個問題:) –

+0

你是對的:),我沒有測試過。現在我剛剛測試過,同樣的問題,它不起作用。也許在一個新的項目上,但使用作曲家更新我有相同的文本完全相同的錯誤(我剛剛複製/粘貼你的代碼和運行作曲家更新)。你有別的事嗎? (或者有可能是我不明白的) –