yarnpkg / yarn

The 1.x line is frozen - features and bugfixes now happen on https://github.com/yarnpkg/berry
https://classic.yarnpkg.com
Other
41.43k stars 2.72k forks source link

`yarn config set cache-folder` should be relative to the current working directory #8202

Open zakhenry opened 4 years ago

zakhenry commented 4 years ago

Bug description

The current behavior of yarn config set cache-folder [dir] does not act as expected - when you declare the dir arg, is is not treated as a relative dir like most unix unix commands do, rather it is added to a shared dir. This can be circumvented by prefixing $(pwd).

Command

cd /
yarn config set cache-folder .yarn-cache

What is the current behavior?

Cache folder is set to /usr/local/share/.yarn-cache

What is the expected behavior?

Cache folder is set to /.yarn-cache/v6

Steps to Reproduce

➜ docker run -it node:alpine sh
/ # yarn config set cache-folder .yarn-cache
yarn config v1.22.4
success Set "cache-folder" to ".yarn-cache".
Done in 0.04s.
/ # yarn cache dir
/usr/local/share/.yarn-cache/v6
/ # yarn config set cache-folder $(pwd)/.yarn-cache
yarn config v1.22.4
success Set "cache-folder" to "//.yarn-cache".
Done in 0.05s.
/ # yarn cache dir
/.yarn-cache/v6

Environment

bcouetil commented 2 years ago

Just stumbled upon this problem, would really like a fix, or at least a full path in log when saying success Set "cache-folder" to XXX