11cb0ef41Sopenharmony_ci--- 21cb0ef41Sopenharmony_cititle: npm-adduser 31cb0ef41Sopenharmony_cisection: 1 41cb0ef41Sopenharmony_cidescription: Add a registry user account 51cb0ef41Sopenharmony_ci--- 61cb0ef41Sopenharmony_ci 71cb0ef41Sopenharmony_ci### Synopsis 81cb0ef41Sopenharmony_ci 91cb0ef41Sopenharmony_ci```bash 101cb0ef41Sopenharmony_cinpm adduser 111cb0ef41Sopenharmony_ci 121cb0ef41Sopenharmony_cialias: add-user 131cb0ef41Sopenharmony_ci``` 141cb0ef41Sopenharmony_ci 151cb0ef41Sopenharmony_ciNote: This command is unaware of workspaces. 161cb0ef41Sopenharmony_ci 171cb0ef41Sopenharmony_ci### Description 181cb0ef41Sopenharmony_ci 191cb0ef41Sopenharmony_ciCreate a new user in the specified registry, and save the credentials to 201cb0ef41Sopenharmony_cithe `.npmrc` file. If no registry is specified, the default registry 211cb0ef41Sopenharmony_ciwill be used (see [`registry`](/using-npm/registry)). 221cb0ef41Sopenharmony_ci 231cb0ef41Sopenharmony_ciWhen using `legacy` for your `auth-type`, the username, password, and 241cb0ef41Sopenharmony_ciemail are read in from prompts. 251cb0ef41Sopenharmony_ci 261cb0ef41Sopenharmony_ci### Configuration 271cb0ef41Sopenharmony_ci 281cb0ef41Sopenharmony_ci#### `registry` 291cb0ef41Sopenharmony_ci 301cb0ef41Sopenharmony_ci* Default: "https://registry.npmjs.org/" 311cb0ef41Sopenharmony_ci* Type: URL 321cb0ef41Sopenharmony_ci 331cb0ef41Sopenharmony_ciThe base URL of the npm registry. 341cb0ef41Sopenharmony_ci 351cb0ef41Sopenharmony_ci 361cb0ef41Sopenharmony_ci 371cb0ef41Sopenharmony_ci#### `scope` 381cb0ef41Sopenharmony_ci 391cb0ef41Sopenharmony_ci* Default: the scope of the current project, if any, or "" 401cb0ef41Sopenharmony_ci* Type: String 411cb0ef41Sopenharmony_ci 421cb0ef41Sopenharmony_ciAssociate an operation with a scope for a scoped registry. 431cb0ef41Sopenharmony_ci 441cb0ef41Sopenharmony_ciUseful when logging in to or out of a private registry: 451cb0ef41Sopenharmony_ci 461cb0ef41Sopenharmony_ci``` 471cb0ef41Sopenharmony_ci# log in, linking the scope to the custom registry 481cb0ef41Sopenharmony_cinpm login --scope=@mycorp --registry=https://registry.mycorp.com 491cb0ef41Sopenharmony_ci 501cb0ef41Sopenharmony_ci# log out, removing the link and the auth token 511cb0ef41Sopenharmony_cinpm logout --scope=@mycorp 521cb0ef41Sopenharmony_ci``` 531cb0ef41Sopenharmony_ci 541cb0ef41Sopenharmony_ciThis will cause `@mycorp` to be mapped to the registry for future 551cb0ef41Sopenharmony_ciinstallation of packages specified according to the pattern 561cb0ef41Sopenharmony_ci`@mycorp/package`. 571cb0ef41Sopenharmony_ci 581cb0ef41Sopenharmony_ciThis will also cause `npm init` to create a scoped package. 591cb0ef41Sopenharmony_ci 601cb0ef41Sopenharmony_ci``` 611cb0ef41Sopenharmony_ci# accept all defaults, and create a package named "@foo/whatever", 621cb0ef41Sopenharmony_ci# instead of just named "whatever" 631cb0ef41Sopenharmony_cinpm init --scope=@foo --yes 641cb0ef41Sopenharmony_ci``` 651cb0ef41Sopenharmony_ci 661cb0ef41Sopenharmony_ci 671cb0ef41Sopenharmony_ci 681cb0ef41Sopenharmony_ci#### `auth-type` 691cb0ef41Sopenharmony_ci 701cb0ef41Sopenharmony_ci* Default: "web" 711cb0ef41Sopenharmony_ci* Type: "legacy" or "web" 721cb0ef41Sopenharmony_ci 731cb0ef41Sopenharmony_ciWhat authentication strategy to use with `login`. Note that if an `otp` 741cb0ef41Sopenharmony_ciconfig is given, this value will always be set to `legacy`. 751cb0ef41Sopenharmony_ci 761cb0ef41Sopenharmony_ci 771cb0ef41Sopenharmony_ci 781cb0ef41Sopenharmony_ci### See Also 791cb0ef41Sopenharmony_ci 801cb0ef41Sopenharmony_ci* [npm registry](/using-npm/registry) 811cb0ef41Sopenharmony_ci* [npm config](/commands/npm-config) 821cb0ef41Sopenharmony_ci* [npmrc](/configuring-npm/npmrc) 831cb0ef41Sopenharmony_ci* [npm owner](/commands/npm-owner) 841cb0ef41Sopenharmony_ci* [npm whoami](/commands/npm-whoami) 851cb0ef41Sopenharmony_ci* [npm token](/commands/npm-token) 861cb0ef41Sopenharmony_ci* [npm profile](/commands/npm-profile) 87