How to tell Yarn to ignore proxy env vars? - proxy

I'm running Linux and have set proxy env vars under /etc/environment which I guess Yarn uses to connect to the npm repository. For some reason, the proxy dies these days and Yarn keeps trying to connect to the proxy without giving me any chance of telling it what to do. I have set export http_proxy="" and export https_proxy="" with no luck. How do I tell Yarn to hey go direct.
Edit: Surprisingly Yarn doesn't respect to anything I set.
passing --proxy "" --https-proxy "" doesn't work.
setting another proxy env doesn't work.
It seems Yarn has a severe problem in respecting user configuration. Installing npm right now.
Anyway, shouldn't it at least prompt me what I should do?

In this case I would use the unset Unix command to clear those proxy variables
unset http_proxy; unset https_proxy
What I have done, because yarn also doesn't respect the no_proxy variable, and I need that part of it, is to essentially create a wrapper shell script over yarn that I use.
~/bin/my_yarn.sh
unset http_proxy; unset https_proxy; yarn $1
Then do ~/bin/my_yarn.sh install to install, or whatever.

Related

Miniconda: issue with shell configuration/initialization

I installed miniconda on our CentOS cluster and it all went fine. Then I asked miniconda to create a python 3.8 environment, and it went fine. However, when I try to activate the environment, I get the following error:
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
To initialize your shell, run
$ conda init <SHELL_NAME>
I verified, and it's a bash environment. So I ran conda init bash and I got the following outputs:
no change /MyPath/miniconda3/condabin/conda
no change /MyPath/miniconda3/bin/conda
no change /MyPath/miniconda3/bin/conda-env
no change /MyPath/miniconda3/bin/activate
no change /MyPath/miniconda3/bin/deactivate
no change /MyPath/miniconda3/etc/profile.d/conda.sh
no change /MyPath/miniconda3/etc/fish/conf.d/conda.fish
no change /MyPath/miniconda3/shell/condabin/Conda.psm1
no change /MyPath/miniconda3/shell/condabin/conda-hook.ps1
no change /MyPath/miniconda3/lib/python3.9/site-packages/xontrib/conda.xsh
no change /MyPath/miniconda3/etc/profile.d/conda.csh
no change /home/users/me/.bashrc
No action taken.
So nothing happens. And when I try to activate the new environment, then I still get the first error.
Any idea how I can fix this?
[Solution] Thanks to the answer below, the issue was that despite testing that I was running/using a bash, I still have to run "bash" in the command line before activating model.
have you tried manually adding to ~/.bashrc?
add export PATH="/home/username/miniconda/bin:$PATH" in your bashrc file. make sure to replace /home/username/miniconda with your actual path now save the file, quit and reopen the terminal should work I guess.

HOME environment variable changes under npm on Windows

I’ve noticed a quirk when running npm scripts via Git Bash on Windows 10. Namely, the value of my HOME variable changes for commands called via npm, as opposed to direct from the shell:
$ env |grep ^HOME=
HOME=/h/
$ npm run env |grep ^HOME=
HOME=C:\Users\jake
This is creating some headaches, because I have scripts which depend on Git and ssh configuration, which are expected to live under $HOME. Does anyone know why this occurs, and/or how to change it?
For now, I’m working around it by maintaining the configs under both HOME paths, but feel like it would be cleaner to use the same path for either context.

Cannot disable proxy to install Homebrew on OS X

I'm experiencing the exact same issue as mentioned in this question, but there are no answers addressing the issue.
I'm currently on my home network and trying to install Homebrew, but it fails as the terminal cannot connect to my corporate proxy. The answers in the question describe how to specify more clearly the proxy you're using to prevent this, but I do not have a proxy at all on my own wifi network. Is there a way to simply remove the proxy settings entirely? I've disabled all proxies in my System Preferences, and unset http_proxy in the shell, but it doesn't help.
In fact, there are no environment variables containing the proxy information anywhere, so I have no idea where curl is getting the information from to begin with. I've tried running the curl command with the --no-proxy flag, and even deleted the variables in my NPM config, since that's the only place I can think of that the proxy URL is currently specified. Still no luck.
Any assistance greatly appreciated!
I figured it out. Since curl is actually downloading Homebrew through Github, it was being routed through the proxy that was set in my global Git configuration, not in my environment variables. If anyone else runs into this:
git config --global --unset http.proxy
Did the trick.
Thanks, me!

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

Yarn environment variable set up in Ubuntu

In the yarn installation doc it is mentioned as below:
Add this to your profile: export PATH="$PATH:/opt/yarn-[version]/bin"
But it is not working for me.
Can anyone explain how to achieve this?
Try with:
export PATH=$PATH:$HOME/.yarn/bin
Still, this won't be permanent, each reboot will start with the past $PATH.

Resources