volta icon indicating copy to clipboard operation
volta copied to clipboard

Is it possible to specify a mirror url for node binaries?

Open wlnirvana opened this issue 4 years ago • 2 comments

nvm does this. And it will definitely help users who have internet connection issues.

wlnirvana avatar Jun 05 '21 09:06 wlnirvana

Hi @wlnirvana, thanks for the question! At the moment it is possible, however it's not as straightforward as using a mirror, unfortunately. You currently need to use the Hooks system, which requires you to build out the full URLs yourself, using the template hook, so it's not ideal. We have plans to revamp the hooks to allow for a Node mirror (among other things), but nothing definitive at the moment.

charlespierce avatar Jun 09 '21 00:06 charlespierce

any update?

wlnirvana avatar Aug 02 '22 07:08 wlnirvana

I'm located in China. When I install Node.js like the following command:

$ volta install node@16

I often encounter the network issue. The terminal may print:

error: Could not download [email protected]
from https://nodejs.org/dist/v16.18.0/node-v16.18.0-win-x64.zip

Please verify your internet connection and ensure the correct version is specified.

So I'm searching for a any way to set the mirror of nodejs when installing it.

gogoend avatar Oct 22 '22 16:10 gogoend

You can use the Hooks system to specify prefixes which can be a mirror to customize the download strategy. Here is my hooks.json file that might be helpful for you to understand how the Hooks system works (be aware that pnpm support is not yet released and you can ignore those fields at this time).

@charlespierce Perhaps we can have production examples of hooks.json on the Hooks doc so newcomers can understand the feature easier. I'm ok putting my hooks.json settings on the site as one example.

chawyehsu avatar Oct 22 '22 17:10 chawyehsu