Closed ivestszheng closed 3 weeks ago
Is "npm" only set to download itselt not registry? It seems when I want to change npm registry I still need to use 'npm config set registry' .
Yes, the hooks.json is specifically about fetching node
, npm
, yarn
, &c themselves. It does not change the behaviors of the individual tools on how to actually fetch individual packages from a customized location. In order to do both things, you would usually use hooks.json
along with an .npmrc
or .yarnrc.yml
.
For example, you might use the following .npmrc
:
registry=https://custom.registry.com/
//custom.registry.com/:_authToken=YOUR_AUTH_TOKEN
Or the following .yarnrc.yml
:
npmRegistryServer: "https://custom.registry.com/"
npmAuthToken: "YOUR_AUTH_TOKEN"
The docs for the hooks.json
are here (source code here), if you have the time we'd love a PR updating the docs so that it makes things clearer here.
Here's my hooks.json in global.
When I use
npm config get registry
,output is stillhttps://registry.npmjs.org/
. It seems not to work. How can I verify Volta hooks.json is valid?Is it supposed to output
https://registry.npmmirror.com/
?