Where does yarn keep global packages? - yarnpkg

How do I find the directory where yarn keeps global packages?
What are the defaults, and how do I find the value based on current configuration?

The default global directories are:
$Env:LOCALAPPDATA/yarn/config/global/node_modules on Windows
~/.config/yarn/global on OSX and non-root Linux
/usr/local/share/.config/yarn/global on Linux if logged in as root
This directory can be overridden by either npm or yarn's prefix, so to get the current value, use:
yarn global dir

Related

How do I get yarn 2 to work in my project?

I cd into my project and run yarn set version berry. It creates the .yarnrc.yml with the yarnPath variable. However, if I do run yarn inside the dir it still defaults to the old Yarn. I made a Makefile with commands like ./.yarn/releases/yarn-berry.cjs + install or start to get Yarn 2 to work. What am I doing wrong?
You have .yarnrc or .yarnrc.yml file in your home directory or in some of the parent folders Yarn 1 finds it and Yarn 2.x never gains control, search for it and remove.

Yarn (Binary) Offline installation on Centos 7

How do i install Yarn (binary) offline on Centos 7. The machine doesn't have internet. Apologise if the question has been asked before.
I couldn't find it anywhere. All Questions point to using Yarn in offline mode but not how to install it offline at the first place.
Finally, i managed to do it via tarball (Note this is Linux installation).
You can install Yarn by downloading a tarball and extracting it anywhere.
cd /opt
wget https://yarnpkg.com/latest.tar.gz
tar zvxf latest.tar.gz
Yarn is now in /opt/yarn-[version]/
the following steps will add Yarn to path variable and run it from anywhere.
Note: your profile may be in your .profile, .bash_profile, .bashrc, .zshrc, etc.
Add this to your profile:
export PATH="$PATH:/opt/yarn-[version]/bin"
(the path may vary depending on where you extracted Yarn to)
In the terminal, log in and log out for the changes to take effect
To have access to Yarn’s executables globally, you will need to set up the PATH environment variable in your terminal. To do this, add
export PATH="$PATH:`yarn global bin`"
to your profile.
Here is the link i found it
Although Yarn can work in offline mode, the packages must be downloaded and stored in the in an offline mirror. Refer to this article.
Your Centos machine will need to be connected to another machine that has access to the Internet. The most common solution is to set up a http/https proxy, then set up yarn to use the proxy
yarn config set proxy http://proxy.server.com:8080
yarn config set https-proxy http://proxy.server.com:8080

change yarn global dir - I can not change the yarn global installation folder

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:\Users\admin\AppData\Local\Yarn\Data\global
Expected behavior
running the command
yarn global dir
shows c:\yarn\global instead
Environnement
Yarn 1.6.0 Node: 9.10.1 OS: win32 x64
you need to add the line --global-folder "c:\yarn\global" manually into your .yarnrc file.
Look here #5746

Yarn keeps using old registry

I've been using yarn with a private registry in the past - however, the registry has now shut down and I want to use yarn with the official registry.
Whatever I do, yarn always seems to want to connect to the old registry and there's simply no way of making it use the new one. I've already tried:
Completely remove and re-install yarn
yarn config set registry https://registry.yarnpkg.com/
Verified that there is no mention of the old registry in either ~/.npmrc or ~/.yarnrc
Cleared the yarn cache using yarn cache clean
No matter what I do, yarn still tries to connect to the old registry on every install and I have no idea where yarn is getting that from...
any ideas?
Remove your global yarn.lock
rm ~/.config/yarn/global/yarn.lock
and then
yarn config set registry https://registry.yarnpkg.com/
Got it, the culprit was ~/.config/yarn/global/yarn.lock...
Running yarn add with --verbose will tell you which .yarnrc files are being picked up. These shouldn't include the old registry.
So run yarn add <your-package> --verbose and check the .yarnrc files found for any mention of the old registry.
In my case, I got it fixed with a rm ~/.npmrc running MacOS

anaconda search path for environments?

Can the anaconda tools that manipulate environments use a search path when looking for environments?
I would like to have a single anaconda installation shared among our group, with a shared set of read-only environments and each user also having their own set of writable personal environments.
Commands like conda env list and conda info -e would have to iterate over an environment search path. So would activate.
Does conda support such an architecture?
I think the answer yes, the envs_dirs configuration parameter can be set in your $HOME/.configrc file (looks like yaml) to change the list of directories searched for environments. You can also set the conda environment search path via the CONDA_ENVS_PATH shell environment variable
https://conda.io/projects/conda/en/latest/user-guide/configuration/use-condarc.html#specify-environment-directories-envs-dirs
However the specific usage scenario outlined above is already handled without modifying any configuration parameters.
If the anaconda install directory is not writable, then conda searches both the shared environments and the environments under $HOME/.conda/envs.
If the anaconda installation directory is writable, the per-user environments in $HOME/envs are silently ignored.

Resources