dependabot/npm_and_yarn/main/copy-to-clipboard-4.0.2
@reggi/path-to-regexp
dependabot/npm_and_yarn/main/copy-to-clipboard-4.0.2
dependabot/npm_and_yarn/main/eslint-10.4.0
dependabot/npm_and_yarn/main/npmcli/eslint-config-7.0.0
dependabot/npm_and_yarn/main/proc-log-7.0.0
dependabot/npm_and_yarn/npm_and_yarn-826852524d
dependabot/npm_and_yarn/npm_and_yarn-ab9a7f4bc2
deprecate-totp-2fa
dhei/classic-tokens
gat-bypass-2fa-docs
jpg619/fix-accessibility-content-flow
jpg619/version-bump-tar-2
kartykp/gat-bypass-2fa-docs
kartykp/upgrade-path-to-regex
main
maitxn/version-bump-tar
patch-1
reggi/cache-based-on-version
reggi/dev-engines
reggi/fix-transform-prettier
reggi/overrides
update-search-sensitivity
| 1 | --- |
| 2 | title: npm-adduser |
| 3 | section: 1 |
| 4 | description: Add a registry user account |
| 5 | github_repo: npm/cli |
| 6 | github_branch: release/v6 |
| 7 | github_path: docs/content/commands/npm-adduser.md |
| 8 | redirect_from: |
| 9 | - /cli-documentation/v6/adduser |
| 10 | - /cli-documentation/v6/cli-commands/adduser |
| 11 | - /cli-documentation/v6/cli-commands/npm-adduser |
| 12 | - /cli-documentation/v6/commands/adduser |
| 13 | - /cli-documentation/v6/commands/npm-adduser |
| 14 | - /cli-documentation/v6/npm-adduser |
| 15 | - /cli/v6/adduser |
| 16 | - /cli/v6/cli-commands/adduser |
| 17 | - /cli/v6/cli-commands/npm-adduser |
| 18 | - /cli/v6/commands/adduser |
| 19 | - /cli/v6/npm-adduser |
| 20 | --- |
| 21 | |
| 22 | ### Synopsis |
| 23 | |
| 24 | ```bash |
| 25 | npm adduser [--registry=url] [--scope=@orgname] [--always-auth] [--auth-type=legacy] |
| 26 | |
| 27 | aliases: login, add-user |
| 28 | ``` |
| 29 | |
| 30 | ### Description |
| 31 | |
| 32 | Create or verify a user named `<username>` in the specified registry, and save the credentials to the `.npmrc` file. If no registry is specified, the default registry will be used (see [`config`](/cli/v6/using-npm/config)). |
| 33 | |
| 34 | The username, password, and email are read in from prompts. |
| 35 | |
| 36 | To reset your password, go to [https://www.npmjs.com/forgot](https://www.npmjs.com/forgot) |
| 37 | |
| 38 | To change your email address, go to [https://www.npmjs.com/email-edit](https://www.npmjs.com/email-edit) |
| 39 | |
| 40 | You may use this command multiple times with the same user account to authorize on a new machine. When authenticating on a new machine, the username, password and email address must all match with your existing record. |
| 41 | |
| 42 | `npm login` is an alias to `adduser` and behaves exactly the same way. |
| 43 | |
| 44 | ### Configuration |
| 45 | |
| 46 | #### registry |
| 47 | |
| 48 | Default: https://registry.npmjs.org/ |
| 49 | |
| 50 | The base URL of the npm package registry. If `scope` is also specified, this registry will only be used for packages with that scope. `scope` defaults to the scope of the project directory you're currently in, if any. See [`scope`](/cli/v6/using-npm/scope). |
| 51 | |
| 52 | #### scope |
| 53 | |
| 54 | Default: none |
| 55 | |
| 56 | If specified, the user and login credentials given will be associated with the specified scope. See [`scope`](/cli/v6/using-npm/scope). You can use both at the same time, e.g. |
| 57 | |
| 58 | ```bash |
| 59 | npm adduser --registry=http://myregistry.example.com --scope=@myco |
| 60 | ``` |
| 61 | |
| 62 | This will set a registry for the given scope and login or create a user for that registry at the same time. |
| 63 | |
| 64 | #### always-auth |
| 65 | |
| 66 | Default: false |
| 67 | |
| 68 | If specified, save configuration indicating that all requests to the given registry should include authorization information. Useful for private registries. Can be used with `--registry` and / or `--scope`, e.g. |
| 69 | |
| 70 | ```bash |
| 71 | npm adduser --registry=http://private-registry.example.com --always-auth |
| 72 | ``` |
| 73 | |
| 74 | This will ensure that all requests to that registry (including for tarballs) include an authorization header. This setting may be necessary for use with private registries where metadata and package tarballs are stored on hosts with different hostnames. See `always-auth` in [`config`](/cli/v6/using-npm/config) for more details on always-auth. Registry-specific configuration of `always-auth` takes precedence over any global configuration. |
| 75 | |
| 76 | #### auth-type |
| 77 | |
| 78 | - Default: `'legacy'` |
| 79 | - Type: `'legacy'`, `'sso'`, `'saml'`, `'oauth'` |
| 80 | |
| 81 | What authentication strategy to use with `adduser`/`login`. Some npm registries (for example, npmE) might support alternative auth strategies besides classic username/password entry in legacy npm. |
| 82 | |
| 83 | ### See Also |
| 84 | |
| 85 | - [npm registry](/cli/v6/using-npm/registry) |
| 86 | - [npm config](/cli/v6/commands/npm-config) |
| 87 | - [npmrc](/cli/v6/configuring-npm/npmrc) |
| 88 | - [npm owner](/cli/v6/commands/npm-owner) |
| 89 | - [npm whoami](/cli/v6/commands/npm-whoami) |