Bug
yarn is not changing its global directory
The following command changes the cache directory. no problem ... thanks Yarn
yarn config set cache-folder c:\yarn\cache
But this command is not changing the global installation dir
yarn config set globa-dir c:\yarn\global
when i check after running this command:
yarn global dir
it displays:
C:Usersb31402.MEAA.000AppDataLocalYarnDataglobal
Expected behavior
running the command
yarn global dir
shows c:yarnglobal instead
Environnement
The name should be global-folder, not globa-dir.
If that too doesn't work try --global-folder "c:\yarn\global" in your config file which should definitely work.
Not working :
yarn global dir
C:Usersb31402.MEAA.000AppDataLocalYarnDataglobal
yarn config set global-folder "C:\ds_raiser\common\yarn\data\global"
yarn config v1.6.0
success Set "global-folder" to "C:\ds_raiser\common\yarn\data\global".
Done in 0.05s.
yarn global dir
C:Usersb31402.MEAA.000AppDataLocalYarnDataglobal
yarn config set --global-folder "C:\ds_raiser\common\yarn\data\global"
yarn config v1.6.0
error Invalid subcommand. Try "set, get, delete, list, current"
info Visit https://yarnpkg.com/en/docs/cli/config for documentation about this command.
Can you report this issue ?
@khalid-elabbadi you need to add the line --global-folder "C:\ds_raiser\common\yarn\data\global" manually into your .yarnrc file.
:+1:
Thank you ! It is working
but why this option is not working with a simple command like:
yarn config set global-folder "C:\ds_raiser\common\yarn\data\global"
but why this option is not working with a simple command like:
Because global-folder is not a supported config option at this time. Would you like to submit a PR that adds it? It would be very similar to #5113.
Are you inviting me to develop this feature and add a PR for it ?
@khalid-elabbadi precisely.
I really would like to, but i have an availablity problem
thanks @BYK
issue on linux
~$ uname -r
4.16.0-kali2-amd64
$ yarn -v
1.9.2
trying to change the global directory to npm. (for god's sake why it's different from npm global)
yarn config set global-folder `npm list -g | head -n 1`
it is changed in the .yarnrc file
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
global-folder "/usr/lib"
lastUpdateCheck 1533550091766
but yarn somehow fails to read its own written config
~$ yarn global dir
~/.config/yarn/global
You can manually edit the .yarnrc file however it says in the file # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. and indeed my change was overwritten
It also reverted the change i made with the cli
yarn config set prefix C:\Users\critc\.yarn\bin\
This happened after i did a global add
$ uname -r
4.18.0-kali1-amd64
$ yarn -v
1.10.1
Checking again no change. Using npm for global installs. Not a severe issue so maybe yarn team postpone it in favor of other ones. But this is the only one which prevents me from dropping npm.
i would like to configure this too, because ~/.config is not proper place for global packages, i rather put it to ~/.cache/yarn/global, so i could sync ~/.config with computers i use.
this means local .yarnrc configuration is absolutely not sufficient.
Thanks
Most helpful comment
@khalid-elabbadi you need to add the line
--global-folder "C:\ds_raiser\common\yarn\data\global"manually into your .yarnrc file.