Yarn runs fine when there is an empty .yarnrc.yml:
touch -- .yarnrc.yml
yarn --version
1.22.19
Yarn runs fine when there is a .yarnrc.yml with a single line feed (LF) character:
echo > .yarnrc.yml
yarn --version
1.22.19
Yarn crashes when there is a .yarnrc.yml with two line feed (LF) characters:
echo >> .yarnrc.yml
yarn --version
TypeError: Cannot read properties of null (reading 'yarnPath')
at loadRcFile (/usr/lib/node_modules/yarn/lib/cli.js:56995:49)
at /usr/lib/node_modules/yarn/lib/cli.js:56966:14
at /usr/lib/node_modules/yarn/lib/cli.js:97395:14
at Array.map (<anonymous>)
at parseRcPaths (/usr/lib/node_modules/yarn/lib/cli.js:97393:78)
at Object.findRc (/usr/lib/node_modules/yarn/lib/cli.js:97407:10)
at getRcConfigForCwd (/usr/lib/node_modules/yarn/lib/cli.js:56965:74)
at /usr/lib/node_modules/yarn/lib/cli.js:88756:56
at Generator.next (<anonymous>)
at step (/usr/lib/node_modules/yarn/lib/cli.js:310:30)
Yarn crashes when there is a .yarnrc.yml with only a comment:
echo '# foobar' > .yarnrc.yml
yarn --version
TypeError: Cannot read properties of null (reading 'yarnPath')
at loadRcFile (/usr/lib/node_modules/yarn/lib/cli.js:56995:49)
at /usr/lib/node_modules/yarn/lib/cli.js:56966:14
at /usr/lib/node_modules/yarn/lib/cli.js:97395:14
at Array.map (<anonymous>)
at parseRcPaths (/usr/lib/node_modules/yarn/lib/cli.js:97393:78)
at Object.findRc (/usr/lib/node_modules/yarn/lib/cli.js:97407:10)
at getRcConfigForCwd (/usr/lib/node_modules/yarn/lib/cli.js:56965:74)
at /usr/lib/node_modules/yarn/lib/cli.js:88756:56
at Generator.next (<anonymous>)
at step (/usr/lib/node_modules/yarn/lib/cli.js:310:30)
Yarn seems to crash whenever there is a .yarnrc.yml that is not empty but does not set any nodes.
I wrote a reproduction case for Sherlock following the guide:
I would like to propose a fix. Please let me know whether one is desired or this issue does not warrant an update to the otherwise frozen Yarn Classic.
Issue
The corresponding issue template did not set a structure. I can edit this issue's description to match the new repository's issue template for bug reports.
Affected versions
I have run into this issue with version 1.22.19 of Yarn as distributed by Arch Linux on version 20.2.0 of Node.js as distributed by Arch Linux:
Reproduction
Yarn runs fine when there is no
.yarnrc.yml
:Yarn runs fine when there is an empty
.yarnrc.yml
:Yarn runs fine when there is a
.yarnrc.yml
with a single line feed (LF) character:Yarn crashes when there is a
.yarnrc.yml
with two line feed (LF) characters:Yarn crashes when there is a
.yarnrc.yml
with only a comment:Yarn seems to crash whenever there is a
.yarnrc.yml
that is not empty but does not set any nodes.I wrote a reproduction case for Sherlock following the guide:
Contribution
I would like to propose a fix. Please let me know whether one is desired or this issue does not warrant an update to the otherwise frozen Yarn Classic.