yarn icon indicating copy to clipboard operation
yarn copied to clipboard

[Bug?]: yarn command crashes after running "yarn config set cache-folder"

Open SpaceTimee opened this issue 1 year ago • 4 comments

Self-service

  • [ ] I'd be willing to implement a fix

Describe the bug

After I ran yarn config set cache-folder by mistake, the cache-folder was set true, and almost any command of yarn crashed.

> yarn config set cache-folder
yarn config v1.22.21
warning package.json: No license field
success Set "cache-folder" to true.
Done in 0.68s.

> yarn cache dir
TypeError [ERR_INVALID_ARG_TYPE]: The "paths[1]" argument must be of type string. Received type boolean (true)

> yarn cache clean
TypeError [ERR_INVALID_ARG_TYPE]: The "paths[1]" argument must be of type string. Received type boolean (true)

> yarn
TypeError [ERR_INVALID_ARG_TYPE]: The "paths[1]" argument must be of type string. Received type boolean (true)

To reproduce

run yarn config set cache-folder

Environment

System:
  OS: Windows 11 10.0.22000
  CPU: (8) x64 Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz
Binaries:
  Node: 20.7.0 - C:\Users\SPACET~1\AppData\Local\Temp\xfs-629213ed\node.CMD
  npm: 10.2.4 - C:\Program Files\nodejs\npm.CMD
  pnpm: 8.15.2 - C:\Program Files\nodejs\pnpm.CMD

Additional context

No response

SpaceTimee avatar May 22 '24 07:05 SpaceTimee

I got yarn back to normal by editing cache-folder in the .yarnrc file, but I think it could be better to return an error when such commands yarn config set cache-folder were typed.

SpaceTimee avatar May 22 '24 11:05 SpaceTimee

yarn config v1.22.21

This appears to be an issue with yarn classic which is frozen https://github.com/yarnpkg/yarn

trivikr avatar May 31 '24 05:05 trivikr

try remove .yarnrc file

I've been through something similar and removed the .yarnrc file to fix the problem.

It will happen again .yarnrc.

shinhanbyeol avatar Jul 01 '24 05:07 shinhanbyeol

As noted, this is an issue with Yarn Classic. The Yarn Modern equivalent yarn config set cacheFolder true does not lead to an error.

clemyan avatar Jul 04 '24 14:07 clemyan