I'd naively assumed that .npmrc lines with double slash ('//') indicate a comment, but that's clearly not the case, because when I delete them, I'm unable to publish to my local registry.
Example:
registry=https://npm.myregistry.io/
//[email protected]
//npm.myregistry.io/:_authToken="Pgwb34F123EQdHqE7OoZA=="
If I remove the above // lines, publish results in
npm ERR! code ENEEDAUTH
npm ERR! need auth auth required for publishing
npm ERR! need auth You need to authorize this machine using `npm adduser`
I can't find any reference to this syntax in npmrc documentation or the ini module parser documentation. I'm assuming it has something to do with synthesized properties?
If, as part of a file transfer, you specify a file located on a Connect:Direct® node by using a file path that starts with a double forward slash (//), the file is treated as a data set.
Comments. Lines in . npmrc files are interpreted as comments when they begin with a ; or # character. .
Per-project config file npmrc file in the root of the project (ie, a sibling of node_modules and package. json ) will set config values specific to this project. Note that this only applies to the root of the project that you're running npm in. It has no effect when your module is published.
//
has no special meaning in .npmrc
or any other .ini
file.
The ini syntax is key = value
. So in this case the key is //npm.myregistry.io/:_authToken
.
This is a Protocol-relative URL, meaning an URL that will take the protocol automatically from the current page (you can actually type //google.com
in the browser, and it should take you to https://google.com
)
Note that this may not necessarily be the URL used by npm for authentication. It's just a format chosen by the developers to hold the authToken
(or other values) in the same string with the registry URL.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With