nomercy2124
nomercy2124•6mo ago

Private NPM Registry config with $HOME/.npmrc and project/.npmrc

I'm trying to introduce Deno into my company that use Azure Npm Registry Something missing with the config below. (That the configuration that work with NPM) My configuration deno : 1.44.4 OS : macos 13.2.1 $HOME/.npmrc
//mycompany.com/npm/registry:username=myusername
//mycompany.com/npm/registry:_password=mypassword
//mycompany.com/npm:username=myusername
//mycompany.com/npm:_password=mypassword
//mycompany.com/npm:email=myemail
//mycompany.com/npm/registry:username=myusername
//mycompany.com/npm/registry:_password=mypassword
//mycompany.com/npm:username=myusername
//mycompany.com/npm:_password=mypassword
//mycompany.com/npm:email=myemail
project/.npmrc
registry=https://mycompany.com/npm/registry
always-auth=true
registry=https://mycompany.com/npm/registry
always-auth=true
The problem According to deno doc we have to change the project/.npmrc or the $HOME/.npmrc like :
@mycompany:registry=http://mycompany.com:8111/
//mycompany.com:8111/:_auth=secretToken
@mycompany:registry=http://mycompany.com:8111/
//mycompany.com:8111/:_auth=secretToken
But... We do not use secretToken. Request Will deno follow .npmrc convention for private NPM registry ? I mean implement username _password like NPM binary does. Will deno will handle multiple .npmrc configuration like our ? Password inside $HOME/.npmrc and registry configuration inside project/.npmrc ? Thanks for reading.
2 Replies
Deno AI Helper
Deno AI Helper•6mo ago
The documentation indicates that Deno supports private NPM registries and provides a way to configure access to them. However, the configuration method described in the documentation differs from the NPM convention you've mentioned. According to the documentation, you should configure your .npmrc file to point to your private registry with an authentication token, and then update your deno.json or package.json to specify the import path for your private package. Here's the relevant excerpt from the documentation:
@mycompany:registry=http://mycompany.com:8111/
//mycompany.com:8111/:_auth=secretToken
@mycompany:registry=http://mycompany.com:8111/
//mycompany.com:8111/:_auth=secretToken
This configuration uses an _auth token for authentication, which is different from the username and _password fields you've used in your NPM configuration. Regarding your question about whether Deno will follow the .npmrc convention for private NPM registries with username and _password, the documentation does not explicitly state that Deno will implement this feature. Deno's current approach for private registries involves using an authentication token. As for handling multiple .npmrc configurations, the documentation does not provide details on this. It specifies setting up the .npmrc file in the project root or $HOME directory, but it does not mention how Deno resolves configurations if both are present. If you need to use a username and password instead of an authentication token, you might consider converting your credentials into a token that can be used with Deno. This process would depend on the capabilities of your private registry and whether it supports generating such tokens. For the time being, you may need to adapt your current setup to align with Deno's method of handling private registries as described in the
Deno AI Helper
Deno AI Helper•6mo ago
documentation. If the current Deno functionality does not meet your requirements, you could also consider reaching out to the Deno community or filing a feature request on the Deno GitHub repository to discuss the possibility of supporting .npmrc configurations with username and _password. Remember to keep an eye on the official Deno release notes and documentation for any updates regarding private registry support, as Deno is actively developed and new features are introduced regularly. 🦕

Did you find this page helpful?