git - 在托管 git 子模块的 docker 中使用 Yarn
问题描述
我有一个开发环境 git repo,其中包含我的应用程序的所有各种组件作为子模块,并且每个子模块都有自己的 docker 容器,这些容器将文件夹作为卷安装。
一些子模块也需要彼此,所以为了减少混淆,我只是将它们列在我的 package.json 中
{
"dependencies": {
//...
"myapp-common": "https://path-to-my-repo.git",
}
}
这很好用,除非我需要yarn
从我的 docker 中运行。当我使用node-sass
不同的软件包时,安装取决于yarn
正在运行的操作系统。
我遇到的问题是当我运行yarn install
等时,我收到此错误:
root@ea69cb8f4e7f:/app# yarn
yarn install v1.10.1
[1/4] Resolving packages...
[2/4] Fetching packages...
error Command failed.
Exit code: 128
Command: git
Arguments: ls-remote --tags --heads https://path-to-my-repo.git
Directory: /app
Output:
fatal: Not a git repository: ../.git/modules/myapp
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
任何想法如何解决这个问题?
解决方案
不是最理想的,但我通过创建一个临时移动.git
文件的 bash 脚本解决了这个问题
#!/bin/bash
mv /app/.git /app/.git.bak
yarn
mv /app/.git.bak /app/.git
yarn start
推荐阅读
- java - IntelliJ IDEA NoClassDefFoundError - AbstractExpectedPatterns
- git - 如何将项目从 Eclipse 推送到 GitHub
- javascript - 图表看起来只有灰色,不显示颜色 - Chartjs,discordjs
- reactjs - reactjs if jsx里面的条件
- flutter - 如何在 Flutter for-in 循环中解析未定义名称“货币”?
- shopify - 如给定图像所示,如何在 shopify 管理订单中显示其他详细信息?
- api - 文档中的 Airflow api 身份验证示例给了我一个 401
- javascript - 正确跟踪 vue-multiselect 中的选项
- python - 使用 matplotlib 增加 x 和 y 值
- python - bs4 从特定表和列中提取数据