volta
volta copied to clipboard
Is it possible to specify a mirror url for node binaries?
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.
any update?
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.
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.