from small one page howto to huge articles all in one place

search text in:




Other .linuxhowtos.org sites:gentoo.linuxhowtos.org



Last additions:
using iotop to find disk usage hogs

using iotop to find disk usage hogs

words:

887

views:

209589

userrating:


May 25th. 2007:
Words

486

Views

258594

why adblockers are bad


Workaround and fixes for the current Core Dump Handling vulnerability affected kernels

Workaround and fixes for the current Core Dump Handling vulnerability affected kernels

words:

161

views:

149886

userrating:


April, 26th. 2006:

Druckversion
You are here: manpages





NPMRC

Section: (5)
Updated: October 2025
Index Return to Main Contents
 

NAME

npmrc- The npm config files  

Description

npm gets its config settings from the command line, environment variables, and npmrc files. The npm config command can be used to update and edit the contents of the user and global npmrc files. For a list of available configuration options, see npm help config.  

Files

The four relevant files are:
*
pe-project config file (/path/to/my/project/.npmrc)
*
pe-user config file (~/.npmrc)
*
global config file ($PREFIX/etc/npmrc)
*
npm builtin config file (/path/to/npm/npmrc)

All npm config files are an in-formatted list of key = value parameters. Environment variables can be replaced using ${VARIABLE_NAME}. By default if the variable is not defined, it is left unreplaced. By adding ? after variable name they can be forced to evaluate to an empty string instead. For example:

cache = ${HOME}/.np-packages
nod-options = "${NODE_OPTIONS?}-us-syste-ca"
Each of these files is loaded, and config options are resolved in priority order. For example, a setting in the userconfig file would override the setting in the globalconfig file. Array values are specified by adding "[lB][rB]" after the key name. For example:
key[lB][rB] = "first value"
key[lB][rB] = "second value"
 

Comments

Lines in .npmrc files are interpreted as comments when they begin with a ; or # character. .npmrc files are parsed by npm/ini lahttps://github.com/npm/inira, which specifies this comment syntax. For example:
# last modified: 01 Jan 2016
; Set a new registry for a scoped package
@myscope:registry=https://mycustomregistry.example.org
 

Pe-project config file

When working locally in a project, a .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. For example, you can't publish a module that forces itself to install globally, or in a different location. Additionally, this file is not read in global mode, such as when running npm install-g.  

Pe-user config file

$HOME/.npmrc (or the userconfig param, if set in the environment or on the command line)  

Global config file

$PREFIX/etc/npmrc (or the globalconfig param, if set above): This file is an in-file formatted list of key = value parameters. Environment variables can be replaced as above.  

Buil-in config file

path/to/npm/itself/npmrc This is an unchangeable "builtin" configuration file that npm keeps consistent across updates. Set fields in here using the ./configure script that comes with npm. This is primarily for distribution maintainers to override default configs in a standard and consistent manner.  

Auth related configuration

The settings _auth, _authToken, username, _password, certfile, and keyfile must all be scoped to a specific registry. This ensures that npm will never send credentials to the wrong host. The full list is:
*
_auth (base64 authentication string)
*
_authToken (authentication token)
*
username
*
_password
*
email
*
cafile (path to certificate authority file)
*
certfile (path to certificate file)
*
keyfile (path to key file)

In order to scope these values, they must be prefixed by a URI fragment. If the credential is meant for any request to a registry on a single host, the scope may look like //registry.npmjs.org/:. If it must be scoped to a specific path on the host that path may also be provided, such as //m-custo-registry.org/unique/path:.

; bad config
_authToken=MYTOKEN

; good config
@myorg:registry=https://somewher-else.com/myorg
@another:registry=https://somewher-else.com/another
//registry.npmjs.org/:_authToken=MYTOKEN

; would apply to both @myorg and @another
//somewher-else.com/:_authToken=MYTOKEN

; would apply only to @myorg
//somewher-else.com/myorg/:_authToken=MYTOKEN1

; would apply only to @another
//somewher-else.com/another/:_authToken=MYTOKEN2
 

See also

*
npm help folders
*
npm help config
*
npm help config
*
package.json la/configurin-npm/packag-jsonra
*
npm help npm


 

Index

NAME
Description
Files
Comments
Per-project config file
Per-user config file
Global config file
Built-in config file
Auth related configuration
See also





Support us on Content Nation
rdf newsfeed | rss newsfeed | Atom newsfeed
- Powered by LeopardCMS - Running on Gentoo -
Copyright 2004-2025 Sascha Nitsch Unternehmensberatung GmbH
Valid XHTML1.1 : Valid CSS
- Level Triple-A Conformance to Web Content Accessibility Guidelines 1.0 -
- Copyright and legal notices -
Time to create this page: 14.7 ms