← 返回命令列表

Linux command

npmrc 命令

网络

复制后可按需替换文件名、目录或参数。

常用示例

Set registry

registry=https://registry.npmjs.org/

Set auth token

//registry.npmjs.org/:_authToken=[token]

Set scope registry

@myorg:registry=https://npm.myorg.com/

Save exact versions

save-exact=true

Set default license

init-license=MIT

说明

.npmrc files configure npm behavior. They can exist at project level, user level (~/.npmrc), or global level. Settings cascade with project taking precedence.

参数

registry
Default registry URL.
save-exact
Save exact versions.
save-prefix
Version prefix (^, ~).
init-author-name
Default author.
init-license
Default license.
//registry/:_authToken
Registry auth token.
@scope:registry
Scope-specific registry.

FAQ

What is the npmrc command used for?

.npmrc files configure npm behavior. They can exist at project level, user level (~/.npmrc), or global level. Settings cascade with project taking precedence.

How do I run a basic npmrc example?

Run `registry=https://registry.npmjs.org/` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does registry do in npmrc?

Default registry URL.