Skip to content

[Bug] Lock file in custom path (.yarn/lock.yml) causes doctor to crash #2497

@stylemistake

Description

@stylemistake
  • I'd be willing to implement a fix

Describe the bug

Well, since yarnrc allows moving the lock file to arbitrary locations, it seemed like a good idea to move it to .yarn folder to keep the root directory one file cleaner.

But not all tools like this new path, and namely @yarnpkg/doctor fails with the following:

➤ YN0001: Error: ENOENT: no such file or directory, open 'C:\Users\style\AppData\Local\Temp\xfs-44fc7c45\dlx-13644\.yarn\lock.yml'
➤ YN0000: Failed with errors in 1s 484ms

To Reproduce

Reproduction

Shell

mv yarn.lock .yarn/lock.yml
echo "lockfileFilename: .yarn/lock.yml" >> .yarnrc.yml
yarn dlx @yarnpkg/doctor

Sherlock

const { promises: fs } = require('fs');

await fs.writeFile('.yarnrc.yml', 'lockfileFilename: .yarn/lock.yml', {
    encoding: 'utf-8',
});

await packageJsonAndInstall({});

const output = yarn('dlx', '@yarnpkg/doctor');
await expect(output).resolves.not.toContain('ENOENT');

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingreproducibleThis issue can be successfully reproducedworking as intendedThe current behavior is intended.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions