volta icon indicating copy to clipboard operation
volta copied to clipboard

Can't install Yarn

Open wenjoy opened this issue 3 years ago • 2 comments

$ volta install yarn

error: Could not download Yarn version registry
from https://registry.npmjs.org/yarn

Please verify your internet connection.

volta version: 1.0.8

My global .npmrc:

registry=https://mirrors.cloud.tencent.com/npm/
home=https://mirrors.cloud.tencent.com/npm/

https://registry.npmjs.org/yarn has been blocked by GFW, but why volta use the default registry instead of my config

wenjoy avatar Sep 09 '22 02:09 wenjoy

Hi @wenjoy, great question! We actually don't use npm internally to fetch Yarn, which is why we don't pick up settings in .npmrc. We do support proxy settings via the HTTP_PROXY and HTTPS_PROXY environment variables.

Alternatively, we have a hooks mechanism described here: https://docs.volta.sh/advanced/hooks that allows you to replace the location that Volta uses to fetch Node, npm, and yarn. However, the hooks behavior around Yarn specifically is a bit complicated since it has to support a legacy use-case, so it may take some extra effort to get it to work. I'm happy to help debug if you want to go that route.

charlespierce avatar Sep 16 '22 21:09 charlespierce

Hi @charlespierce, where were find the doc for using proxy variables to install node with volta?

luanLTS avatar Sep 22 '22 12:09 luanLTS

Hi @wenjoy, great question! We actually don't use npm internally to fetch Yarn, which is why we don't pick up settings in .npmrc. We do support proxy settings via the HTTP_PROXY and HTTPS_PROXY environment variables.

Alternatively, we have a hooks mechanism described here: https://docs.volta.sh/advanced/hooks that allows you to replace the location that Volta uses to fetch Node, npm, and yarn. However, the hooks behavior around Yarn specifically is a bit complicated since it has to support a legacy use-case, so it may take some extra effort to get it to work. I'm happy to help debug if you want to go that route.

Thanks, @charlespierce, you are very kind 👍🏿. I have resolved this issue with a proxy, so I think I should close this issue.

wenjoy avatar Sep 27 '22 03:09 wenjoy

Hi @charlespierce, where were find the doc for using proxy variables to install node with volta?

I think all we need to do is set HTTP_PROXY and HTTPS_PROXY environment variables. It's the mechanism of OS. I doubt there is a specific doc on Volta's side.

wenjoy avatar Sep 27 '22 03:09 wenjoy