My project has an .npmrc located in its root, which contains the infamous ${NPM_TOKEN} hack and is required for CI, Staging, Production, etc.
In order to work around this reality, I'd like for developers to be able to tell npm
to use an alternative .npmrc, which contains their _authToken
, when installing dependencies. Something like, npm install . --npmrc=~/.npmrc
. This would prevent them from having to pollute their system's environment variables, .bash_profile, etc.
Is this currently possible? (Doesn't seem so...) If not, are there any reasons why such an approach either wouldn't be possible (highly unlikely) or wouldn't be considered by the NPM team?
My answer would say it's best to ignore it and not push to repo. as if you have multiple Engineers contributing changes to a generated package for push to the registry each developer will have to have their own .
You can also install packages from feeds and public registries such as npmjs.com. To authenticate with Azure Artifacts, we must first set up our config file. Npm uses . npmrc configuration files to store feed URLs and credentials.
npmrc file located in your user's home directory with the npm config command and the public URL of your repository group available in the repository list by clicking the copy button in the URL column of either Administration → Repository → Repositories or user's Browse page.
npmrc file? This file is a configuration file for NPM, it defines the settings on how NPM should behave when running commands.
As luck would have it, this option already exists and can be used like so:
npm install . --userconfig=~/.npmrc
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