Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Yarn fails to install (Exit code: 128) #3303

Closed
andrewhavens opened this issue May 2, 2017 · 14 comments
Closed

Bug: Yarn fails to install (Exit code: 128) #3303

andrewhavens opened this issue May 2, 2017 · 14 comments

Comments

@andrewhavens
Copy link

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.

  • Node: 7.9.0
  • Yarn: 0.23.3
  • macOS Sierra 10.12.4
@EugeneHlushko
Copy link

EugeneHlushko commented May 3, 2017

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.
  • node: 7.4.0
  • yarn 0.23.2
  • CentOS release 6.8 (Final)

@EugeneHlushko
Copy link

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

@xiankai
Copy link

xiankai commented May 18, 2017

I think this can result from trying to install a deleted git branch as well - I was using a custom fork over here apollographql/graphql-tag#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.

@andrewhavens
Copy link
Author

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.

@bestander
Copy link
Member

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.

@jppellerin
Copy link

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.

@juanca
Copy link
Contributor

juanca commented Jun 2, 2017

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.

@rally25rs
Copy link
Contributor

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.

@jorisroling
Copy link

I solved it by removing the enire yarn cache (/Users//Library/Caches/Yarn)

@ancadenisa
Copy link

ancadenisa commented Dec 20, 2018

I had this kind of error (note that after "Fatal", it says somehting about being unable to access git...)
image
I solved it by updating to the latest git version.

@NenX
Copy link

NenX commented Sep 9, 2019

yarn cache clean
rm yarn.lock
rm -rf node_modules/

and then run

yarn

@ghasemikasra39
Copy link

same here

@mcrisostomo
Copy link

Thank you @rally25rs. You helped me a lot!

@ghost
Copy link

ghost commented Mar 27, 2021

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

Thanks! This works for me.

@yarnpkg yarnpkg locked as resolved and limited conversation to collaborators Mar 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests