1--- 2title: npm-adduser 3section: 1 4description: Add a registry user account 5--- 6 7### Synopsis 8 9```bash 10npm adduser 11 12alias: add-user 13``` 14 15Note: This command is unaware of workspaces. 16 17### Description 18 19Create a new user in the specified registry, and save the credentials to 20the `.npmrc` file. If no registry is specified, the default registry 21will be used (see [`registry`](/using-npm/registry)). 22 23When using `legacy` for your `auth-type`, the username, password, and 24email are read in from prompts. 25 26### Configuration 27 28#### `registry` 29 30* Default: "https://registry.npmjs.org/" 31* Type: URL 32 33The base URL of the npm registry. 34 35 36 37#### `scope` 38 39* Default: the scope of the current project, if any, or "" 40* Type: String 41 42Associate an operation with a scope for a scoped registry. 43 44Useful when logging in to or out of a private registry: 45 46``` 47# log in, linking the scope to the custom registry 48npm login --scope=@mycorp --registry=https://registry.mycorp.com 49 50# log out, removing the link and the auth token 51npm logout --scope=@mycorp 52``` 53 54This will cause `@mycorp` to be mapped to the registry for future 55installation of packages specified according to the pattern 56`@mycorp/package`. 57 58This will also cause `npm init` to create a scoped package. 59 60``` 61# accept all defaults, and create a package named "@foo/whatever", 62# instead of just named "whatever" 63npm init --scope=@foo --yes 64``` 65 66 67 68#### `auth-type` 69 70* Default: "web" 71* Type: "legacy" or "web" 72 73What authentication strategy to use with `login`. Note that if an `otp` 74config is given, this value will always be set to `legacy`. 75 76 77 78### See Also 79 80* [npm registry](/using-npm/registry) 81* [npm config](/commands/npm-config) 82* [npmrc](/configuring-npm/npmrc) 83* [npm owner](/commands/npm-owner) 84* [npm whoami](/commands/npm-whoami) 85* [npm token](/commands/npm-token) 86* [npm profile](/commands/npm-profile) 87