最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Yarn install: "Not a git repository" error when fetching packages - Stack Overflow

programmeradmin3浏览0评论

System: Windows 10 64 bit

I am trying to build a JavaScript project using yarn install --lock-file in the repository directory. When yarn tries to fetch the packages, it fails with the following error message:

Exit code: 128 Command: git Arguments: pull Directory: C:\Users\[UserDirectory]\AppData\Local\Yarn\Cache\v2.tmp\9f5ed3b3940e461693021bf6d9a7805d Output: fatal: not a git repository (or any of the parent directories): .git

I cannot figure out why yarn is trying to use git pull in another directory. Can you explain me what yarn is doing here?

Edit: At first, I guessed it must be an issue with access rights, but running it with elevated access gave the same result. The same goes for yarn install, so without the --frozen-lockfile flag.

System: Windows 10 64 bit

I am trying to build a JavaScript project using yarn install --lock-file in the repository directory. When yarn tries to fetch the packages, it fails with the following error message:

Exit code: 128 Command: git Arguments: pull Directory: C:\Users\[UserDirectory]\AppData\Local\Yarn\Cache\v2.tmp\9f5ed3b3940e461693021bf6d9a7805d Output: fatal: not a git repository (or any of the parent directories): .git

I cannot figure out why yarn is trying to use git pull in another directory. Can you explain me what yarn is doing here?

Edit: At first, I guessed it must be an issue with access rights, but running it with elevated access gave the same result. The same goes for yarn install, so without the --frozen-lockfile flag.

Share Improve this question edited Dec 10, 2018 at 15:11 Mygeen asked Oct 14, 2018 at 9:19 MygeenMygeen 1611 silver badge10 bronze badges 4
  • I guess it is not a git problem? maybe you could remove the git tag then – OznOg Commented Oct 14, 2018 at 9:40
  • @OznOg I was not entirely sure, as I do not pletely understand what is happing this point. But I guess you are right to exclude a misbehavior in git? – Mygeen Commented Oct 14, 2018 at 10:15
  • well git error is clear, you are atempting to perform a git pull in a directory which is not a git directory (ie, git cannot find its metadata in the .git subdirectory that should be there) – OznOg Commented Oct 14, 2018 at 10:17
  • Yes, true.Removed it – Mygeen Commented Oct 14, 2018 at 10:42
Add a ment  | 

2 Answers 2

Reset to default 14

I was getting the same error in a repo of mine too for any Yarn mand.

Removing the Yarn Cache fixed Yarn for me: yarn cache clean (remended) or

rm -rf C:\Users\<user>\AppData\Local\Yarn\Cache\v2.tmp\<hash> # the older hacky way

if someone still can't solve the problem, can try git init

发布评论

评论列表(0)

  1. 暂无评论