Yarn install fails

Yarn prints No lockfile found, although a yarn.lock file does exist:

#!/bin/bash -eo pipefail
ls -a && yarn install --frozen-lockfile --cache-folder ~/.cache/yarn

.	       .gitignore	.vscode		       nodejs.d.ts
..	       .ignore		__mocks__	       package.json
.circleci      .npmrc		babel.config.js        services
.editorconfig  .nvmrc		infrastructure	       tooling
.eslintrc.js   .prettierignore	jest.unit.config.js    tsconfig.json
.git	       .prettierrc.js	lib		       yarn.lock
.github        .tool-versions	lint-staged.config.js
yarn install v1.22.5
[1/4] Resolving packages...
[2/4] Fetching packages...
info No lockfile found

And then, it goes on to fail with the following error (the package that fails is not always the same):

[3/5] Fetching packages...
error https://registry.yarnpkg.com/yargs/-/yargs-15.4.1.tgz: Extracting tar content of undefined failed, the file appears to be corrupt: "ENOENT: no such file or directory, chmod '/home/circleci/.cache/yarn/v6/npm-yargs-15.4.1-0d87a16de01aee9d8bec2bfbf74f67851730f4f8-integrity/node_modules/yargs/locales/pl.json'"

To rule out a problem with the cache, the cache restoration step doesn’t find a hit, which is expected:

No cache is found for key: v2-yarn-cache-Ojz5x6Ac2zSAU1v7NJ2eg7wNFcg3NYNmISIFx8o23sk=

I cannot reproduce this behaviour locally.

Has anybody else experienced this issue?

Hi @gmunguia! Is this still happening? I’ve found a couple similar issues, but they all look related to yarn inside of Docker. Let me know if we can dig more or if you found a solution!

Hi, thanks for having a look!

The error magically disappeared without us changing the code, just retrying the same build. However, the problem with yarn not finding the lockfile persist.

1 Like

Sadly, I started getting the ENOENT error again. Rerunning the same build now sometimes yields a different error instead:

An unexpected error occurred: “ENOTEMPTY: directory not empty, rmdir ‘/home/circleci/.cache/yarn/v6/npm-lodash-4.17.21-679591c564c3bffaae8454cf0b3df370c3d6911c-integrity/node_modules/lodash’”

Hi @gmunguia,

If you haven’t already, could you please give the circleci/node orb a try?

In case the issue persists, please submit a Support ticket so we can further investigate.

1 Like