Do you want to request a feature or report a bug?
Bug
What is the current behavior?
Yarn fails to install and does not provide any helpful error message for debugging. I have already done this:
rm -rf node_modules
rm -rf /Users/andrew/Library/Caches/Yarn
..but it has not made any difference.
If the current behavior is a bug, please provide the steps to reproduce.
$ yarn
yarn install v0.23.3
[1/4] 馃攳 Resolving packages...
[2/4] 馃殮 Fetching packages...
error Command failed.
Exit code: 128
Command: git
Arguments: archive f1c99c8e4f13d85cedeaa9d4dc4db8dabe55a796
Directory: /Users/andrew/Library/Caches/Yarn/v1/.tmp/f1b469ac943bb80864be5dfa2512836d
Output:
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
Yarn seems to install in other projects. Inspecting the directory that is mentioned in the output:
$ cat /Users/andrew/Library/Caches/Yarn/v1/.tmp/f1b469ac943bb80864be5dfa2512836d/package.json
{
"name": "ember-cli-inject-live-reload",
"version": "1.4.0",
"description": "Plugin for ember-cli that injects live-reload script into HTML content.",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"ember-addon"
],
"ember-addon": {
"before": "serve-files-middleware"
},
"author": "Robert Jackson",
"license": "MIT",
"dependencies": {},
"devDependencies": {},
"repository": {
"type": "git",
"url": "git://github.com/rwjblue/ember-cli-inject-live-reload.git"
},
"bugs": {
"url": "https://github.com/rwjblue/ember-cli-inject-live-reload/issues"
},
"homepage": "https://github.com/rwjblue/ember-cli-inject-live-reload"
}
What is the expected behavior?
I expect install to succeed or at least provide an actionable error message.
Please mention your node.js, yarn and operating system version.
Same thing, happened after yarn cache clean
i run yarn
...
verbose 5.829 Performing "GET" request to "https://registry.yarnpkg.com/hasha/-/hasha-2.2.0.tgz".
verbose 5.863 Error: Command failed.
Exit code: 128
Command: git
Arguments: archive 21ad58025a6ed02553074fc9976decfa6f62c450
Directory:/PATH/TO/CACHE/.cache/yarn/v1/.tmp/f020ebe3c91f3d060014c40ba6618842
Output:
at ChildProcess.proc.on.code (/usr/share/yarn/lib/util/child.js:107:15)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:885:16)
at Socket.<anonymous> (internal/child_process.js:334:11)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at Pipe._handle.close [as _onclose] (net.js:501:12)
error Command failed.
Exit code: 128
Command: git
Arguments: archive 21ad58025a6ed02553074fc9976decfa6f62c450
Directory: /PATH/TO/CACHE/.cache/yarn/v1/.tmp/f020ebe3c91f3d060014c40ba6618842
Output:
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
Oh yes, if you fail to proceed with yarn install because of this error, just delete your lockfile (yarn.lock
) and run yarn install
again
I think this can result from trying to install a deleted git branch as well - I was using a custom fork over here https://github.com/apollographql/graphql-tag/pull/52, but when it got merged/deleted, I started encountering a similar error:
error Command failed.
Exit code: 128
Command: git
Arguments: archive d4b3e319206be3f7e1ec9f0ad7e90d30a748d43f
Where on the last line, was the commit hash of the deleted branch. I switched to the main branch since the pull request had been merged, for my fix.
I think I found the reason for my original error. I think one of the packages that was linked to a branch had a commit deleted, or force-pushed updates. Unfortunately, I don't know for sure and the yarn error message does not make it clear if that was the case or not.
I think there are several issues discussed here.
We have fixed a git related issue in 0.25.
Feel free to open a new issue with steps to reproduce if it still remains.
I was getting the same error when trying to yarn add
our common library from bitbucket. After reading this and trying a few things without success I thought I'd try npm
to see how it would behave. Also erroring out but I got a better error message :
ENOTEMPTY: directory not empty, rmdir '/mnt/c/Users/[user]/Documents/workspace/[project]/node_modules/common-js/dist'
Using WSL. Seems like it cannot remove the old directory properly.
I know this is probably unrelated to yarn, but thought I'd post anyways for information purposes.
I got this same error. I was able to reproduce and fix the issue (it was direct mistake from me).
Basically, I have a git dependency (and it's pointing a branch) that is tracked in the yarn lockfile. At some point during the day, I force pushed my git branch which clobbered the tracked sha. I verified that the clobbered sha was the git archive CLOBBERED_SHA
presented in the error message.
The fix was to yarn upgrade <git-dependency>
(if you're on latest). Otherwise, you can yarn add <git+ssh://...#branch> --force
.
I tend to get this error when using a github dependency and switching between branches.
For those that run into this issue, you can usually fix it by deleting the cace folder from the output.
$ yarn
yarn install v0.23.3
[1/4] 馃攳 Resolving packages...
[2/4] 馃殮 Fetching packages...
error Command failed.
Exit code: 128
Command: git
Arguments: archive f1c99c8e4f13d85cedeaa9d4dc4db8dabe55a796
Directory: /Users/andrew/Library/Caches/Yarn/v1/.tmp/f1b469ac943bb80864be5dfa2512836d
Output:
Fix it by deleting: /Users/andrew/Library/Caches/Yarn/v1/.tmp/f1b469ac943bb80864be5dfa2512836d
then rerun yarn.
I think yarn is reusing the cache directory, but git doesn't like overwriting one branch with another in that directory.
I solved it by removing the enire yarn cache (/Users/
I had this kind of error (note that after "Fatal", it says somehting about being unable to access git...)
I solved it by updating to the latest git version.
yarn cache clean
rm yarn.lock
rm -rf node_modules/
and then run
yarn
same here
Thank you @rally25rs. You helped me a lot!
Most helpful comment
I tend to get this error when using a github dependency and switching between branches.
For those that run into this issue, you can usually fix it by deleting the cace folder from the output.
Fix it by deleting:
/Users/andrew/Library/Caches/Yarn/v1/.tmp/f1b469ac943bb80864be5dfa2512836d
then rerun yarn.I think yarn is reusing the cache directory, but git doesn't like overwriting one branch with another in that directory.