2020-11-01 07:54:36 +01:00
|
|
|
---
|
2019-11-05 14:55:08 -05:00
|
|
|
title: npm-adduser
|
2020-11-01 07:54:36 +01:00
|
|
|
section: 1
|
|
|
|
description: Add a registry user account
|
2019-11-05 14:55:08 -05:00
|
|
|
---
|
2011-11-21 09:48:45 -08:00
|
|
|
|
2019-11-05 14:55:08 -05:00
|
|
|
### Synopsis
|
2016-03-29 23:30:51 -07:00
|
|
|
|
2019-11-05 14:55:08 -05:00
|
|
|
```bash
|
2022-02-24 21:41:49 +00:00
|
|
|
npm adduser
|
2019-11-05 14:55:08 -05:00
|
|
|
|
2022-12-06 22:18:33 -05:00
|
|
|
alias: add-user
|
2019-11-05 14:55:08 -05:00
|
|
|
```
|
|
|
|
|
2021-03-23 14:58:11 -04:00
|
|
|
Note: This command is unaware of workspaces.
|
|
|
|
|
2019-11-05 14:55:08 -05:00
|
|
|
### Description
|
2011-11-21 09:48:45 -08:00
|
|
|
|
2022-12-06 22:18:33 -05:00
|
|
|
Create a new user in the specified registry, and save the credentials to
|
|
|
|
the `.npmrc` file. If no registry is specified, the default registry
|
|
|
|
will be used (see [`registry`](/using-npm/registry)).
|
2011-11-21 09:48:45 -08:00
|
|
|
|
2022-12-06 22:18:33 -05:00
|
|
|
When using `legacy` for your `auth-type`, the username, password, and
|
|
|
|
email are read in from prompts.
|
2014-09-24 14:41:07 -07:00
|
|
|
|
2019-11-05 14:55:08 -05:00
|
|
|
### Configuration
|
2011-11-21 09:48:45 -08:00
|
|
|
|
2021-05-20 15:54:50 -04:00
|
|
|
#### `registry`
|
2011-11-21 09:48:45 -08:00
|
|
|
|
2021-05-20 15:54:50 -04:00
|
|
|
* Default: "https://registry.npmjs.org/"
|
|
|
|
* Type: URL
|
2011-11-21 09:48:45 -08:00
|
|
|
|
2021-05-20 15:54:50 -04:00
|
|
|
The base URL of the npm registry.
|
2014-09-24 14:41:07 -07:00
|
|
|
|
2023-06-08 05:24:49 -07:00
|
|
|
|
|
|
|
|
2021-05-20 15:54:50 -04:00
|
|
|
#### `scope`
|
2014-09-24 14:41:07 -07:00
|
|
|
|
2021-05-20 15:54:50 -04:00
|
|
|
* Default: the scope of the current project, if any, or ""
|
|
|
|
* Type: String
|
2014-09-24 14:41:07 -07:00
|
|
|
|
2021-05-20 15:54:50 -04:00
|
|
|
Associate an operation with a scope for a scoped registry.
|
2014-09-24 14:41:07 -07:00
|
|
|
|
2021-05-20 15:54:50 -04:00
|
|
|
Useful when logging in to or out of a private registry:
|
|
|
|
|
|
|
|
```
|
|
|
|
# log in, linking the scope to the custom registry
|
|
|
|
npm login --scope=@mycorp --registry=https://registry.mycorp.com
|
|
|
|
|
|
|
|
# log out, removing the link and the auth token
|
|
|
|
npm logout --scope=@mycorp
|
2020-10-20 17:02:27 -04:00
|
|
|
```
|
2014-09-24 14:41:07 -07:00
|
|
|
|
2021-05-20 15:54:50 -04:00
|
|
|
This will cause `@mycorp` to be mapped to the registry for future
|
|
|
|
installation of packages specified according to the pattern
|
|
|
|
`@mycorp/package`.
|
2011-11-21 09:48:45 -08:00
|
|
|
|
2021-05-20 15:54:50 -04:00
|
|
|
This will also cause `npm init` to create a scoped package.
|
|
|
|
|
|
|
|
```
|
|
|
|
# accept all defaults, and create a package named "@foo/whatever",
|
|
|
|
# instead of just named "whatever"
|
|
|
|
npm init --scope=@foo --yes
|
|
|
|
```
|
2017-04-12 21:47:49 -07:00
|
|
|
|
|
|
|
|
2023-06-08 05:24:49 -07:00
|
|
|
|
2022-06-13 23:04:21 -07:00
|
|
|
#### `auth-type`
|
|
|
|
|
2022-12-06 22:18:33 -05:00
|
|
|
* Default: "web"
|
|
|
|
* Type: "legacy" or "web"
|
2022-06-13 23:04:21 -07:00
|
|
|
|
2023-01-16 22:38:23 -05:00
|
|
|
What authentication strategy to use with `login`. Note that if an `otp`
|
|
|
|
config is given, this value will always be set to `legacy`.
|
2022-06-13 23:04:21 -07:00
|
|
|
|
2023-06-08 05:24:49 -07:00
|
|
|
|
|
|
|
|
2019-11-05 14:55:08 -05:00
|
|
|
### See Also
|
2011-11-21 09:48:45 -08:00
|
|
|
|
2019-11-05 14:55:08 -05:00
|
|
|
* [npm registry](/using-npm/registry)
|
2020-11-01 07:54:36 +01:00
|
|
|
* [npm config](/commands/npm-config)
|
2019-11-05 14:55:08 -05:00
|
|
|
* [npmrc](/configuring-npm/npmrc)
|
2020-11-01 07:54:36 +01:00
|
|
|
* [npm owner](/commands/npm-owner)
|
|
|
|
* [npm whoami](/commands/npm-whoami)
|
2021-05-20 15:54:50 -04:00
|
|
|
* [npm token](/commands/npm-token)
|
|
|
|
* [npm profile](/commands/npm-profile)
|