← 返回命令列表

Linux command

npm-login 命令

文本

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

常用示例

Login to npm registry

npm login

Login to specific registry

npm login --registry=[https://registry.example.com]

Login with scope

npm login --scope=@[myorg]

Check login status

npm whoami

Logout

npm logout

说明

npm login (also npm adduser) authenticates with an npm registry. Credentials are stored in ~/.npmrc and used for publishing and accessing private packages. For npmjs.com, this enables publishing packages and accessing private organization packages. The command `npm adduser` is an alias for `npm login`.

参数

--registry _url_
Registry URL.
--scope _scope_
Associate login with scope.
--auth-type _type_
Authentication type (legacy, web).

FAQ

What is the npm-login command used for?

npm login (also npm adduser) authenticates with an npm registry. Credentials are stored in ~/.npmrc and used for publishing and accessing private packages. For npmjs.com, this enables publishing packages and accessing private organization packages. The command `npm adduser` is an alias for `npm login`.

How do I run a basic npm-login example?

Run `npm login` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --registry _url_ do in npm-login?

Registry URL.