gpt4 book ai didi

git - 在托管 git 子模块的 docker 中使用 Yarn

转载 作者:行者123 更新时间:2023-12-02 18:06:10 27 4
gpt4 key购买 nike

我有一个开发环境 git repo,其中包括我的应用程序的所有不同组件作为子模块,并且这些子模块中的每一个都有自己的 docker 容器,这些容器将文件夹作为一个卷安装。

一些子模块也需要彼此,所以为了减少混淆,我只是将它们列在我的 package.json 中

{
"dependencies": {
//...
"myapp-common": "https://path-to-my-repo.git",
}
}

这工作正常,除了当我需要从我的 docker 中运行 yarn 时。当我使用 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

关于git - 在托管 git 子模块的 docker 中使用 Yarn,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53202831/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com