![](/img/trans.png)
[英]Composer update - Script cache:clear returned with error code 255
[英]error code 1 cache:clear during composer require
無法按照 github 示例安裝/要求 ongr/elasticsearch-bundle“~5.0”。
我正在運行最新的 symfony 的全新安裝。
我正在運行以下命令:composer require ongr/elasticsearch-bundle "~5.0"
根據https://github.com/ongr-io/ElasticsearchBundle
composer require ongr/elasticsearch-bundle "~5.0"
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Restricting packages listed in "symfony/symfony" to "4.2.*"
Package operations: 7 installs, 0 updates, 0 removals
- Installing react/promise (v2.7.1): Loading from cache
- Installing guzzlehttp/streams (3.0.0): Loading from cache
- Installing guzzlehttp/ringphp (1.1.1): Loading from cache
- Installing elasticsearch/elasticsearch (v5.5.0): Loading from cache
- Installing ongr/elasticsearch-dsl (v5.0.6): Loading from cache
- Installing symfony/templating (v4.2.11): Loading from cache
- Installing ongr/elasticsearch-bundle (v5.2.4): Loading from cache
Writing lock file
Generating autoload files
ocramius/package-versions: Generating version class...
ocramius/package-versions: ...done generating version class
Symfony operations: 1 recipe (c91982d16a3859d0a43fd4ff85aa437a)
- Configuring ongr/elasticsearch-bundle (>=v5.2.4): From auto-generated recipe
Executing script cache:clear [KO]
[KO]
Script cache:clear returned with error code 1
!!
!! In ArrayNode.php line 228:
!!
!! The child node "managers" at path "ongr_elasticsearch" must be configured.
!!
!!
!!
Script @auto-scripts was called via post-update-cmd
Installation failed, reverting ./composer.json to its original content.
我能做些什么來解決這個問題?
本教程提到了一個 config.yml(我沒有),我假設如果它在安裝過程中不存在就會被創建
問題在於,有一個腳本可以在安裝新的依賴項之后立即清除Symfony緩存,然后您才有機會向配置文件中添加正確的配置。
假設您的composer.json
文件中有一個部分看起來像這樣:
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
},
您應該刪除"cache:clear": "symfony-cmd"
行。 如果看起來不完全像這樣,只需刪除所有包含cache:clear
。 在成功安裝和配置ongr/elasticsearch-bundle
,您可能想恢復此行/這些行,這樣就不必記住在安裝與Symfony Flex更好地兼容的捆綁包之后手動清除緩存。不要因為試圖提供幫助而成為其狂熱的受害者。
另外,這可能是一個更好的解決方案-完全擺脫symfony/flex
。 當某些第三方在不檢查是否滿足所有要求的情況下將命令添加到配方中時,就有一個搞亂您的配置文件的習慣。 我知道,我去過那里。
您可以使用--no-scripts
選項繞過 cache:clear 在開始時,只需在了解情況下使用它,因為繞過緩存清除會在啟動應用程序時從舊用途中創建常規緩存問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.