在托管 git 子模块的 docker 中使用 Yarn
Use Yarn within a docker that is hosting a git submodule
我有一个开发环境 git 存储库,其中包括我的应用程序的所有不同组件作为子模块,并且每个子模块都有自己的 docker 容器,这些容器将文件夹作为一个卷安装。
一些子模块也需要彼此,所以为了减少混淆,我只是将它们列在我的 package.json
中
{
"dependencies": {
//...
"myapp-common": "https://path-to-my-repo.git",
}
}
这很好用,除了 当我需要从我的 docker 中 运行 yarn
时。当我使用 node-sass
之类的东西时,根据 OS 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
我有一个开发环境 git 存储库,其中包括我的应用程序的所有不同组件作为子模块,并且每个子模块都有自己的 docker 容器,这些容器将文件夹作为一个卷安装。
一些子模块也需要彼此,所以为了减少混淆,我只是将它们列在我的 package.json
中{
"dependencies": {
//...
"myapp-common": "https://path-to-my-repo.git",
}
}
这很好用,除了 当我需要从我的 docker 中 运行 yarn
时。当我使用 node-sass
之类的东西时,根据 OS 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
文件
#!/bin/bash
mv /app/.git /app/.git.bak
yarn
mv /app/.git.bak /app/.git
yarn start