错误:chart 需要依赖项。Chart.yaml 有依赖项,但没有 'charts/' 目录。运行 'helm dependency update' 以生成 charts 目录。
Error: chart requires dependencies. Chart.yaml has dependencies but no 'charts/' directory. Run 'helm dependency update' to generate the charts directory.
ID: cicd/helm-chart-dependency-missing
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| Helm 3.12.0 | active | — | — | — |
| Helm 3.14.1 | active | — | — | — |
根因分析
Helm chart 在 Chart.yaml 中声明了依赖项,但 charts/ 目录缺失,因为依赖项未下载或未提交到仓库。
English
Helm chart has declared dependencies in Chart.yaml but the charts/ directory is missing because dependencies were not downloaded or committed to the repository.
官方文档
https://helm.sh/docs/helm/helm_dependency/解决方案
-
Run 'helm dependency update ./chart-dir' in the chart directory to download dependencies into the charts/ folder. Then commit the charts/ directory to your repository.
-
Add a CI step before deployment: 'helm dependency build ./chart-dir' to ensure dependencies are fetched fresh each build without committing charts/.
无效尝试
常见但无效的做法:
-
90% 失败
Manually creating an empty charts/ directory does not resolve the error because the actual dependency packages are missing.
-
70% 失败
Deleting Chart.yaml dependencies and re-adding them without running helm dependency update still leaves charts/ empty.
-
50% 失败
Using helm install --dependency-update flag may fail if the chart repository is not accessible (e.g., private repo).