1NPM-LOGIN(1) NPM-LOGIN(1)
2
3
4
6 npm-login - Login to a registry user account
7
8 Synopsis
9 npm login
10
11 Note: This command is unaware of workspaces.
12
13 Description
14 Verify a user in the specified registry, and save the credentials to
15 the .npmrc file. If no registry is specified, the default registry will
16 be used (see npm help config).
17
18 When using legacy for your auth-type, the username and password, are
19 read in from prompts.
20
21 To reset your password, go to ⟨https://www.npmjs.com/forgot⟩
22
23 To change your email address, go to ⟨https://www.npmjs.com/email-edit⟩
24
25 You may use this command multiple times with the same user account to
26 authorize on a new machine. When authenticating on a new machine, the
27 username, password and email address must all match with your existing
28 record.
29
30 Configuration
31 registry
32 • Default: "https://registry.npmjs.org/"
33
34 • Type: URL
35
36
37 The base URL of the npm registry.
38
39 scope
40 • Default: the scope of the current project, if any, or ""
41
42 • Type: String
43
44
45 Associate an operation with a scope for a scoped registry.
46
47 Useful when logging in to or out of a private registry:
48
49 # log in, linking the scope to the custom registry
50 npm login --scope=@mycorp --registry=https://registry.mycorp.com
51
52 # log out, removing the link and the auth token
53 npm logout --scope=@mycorp
54
55 This will cause @mycorp to be mapped to the registry for future instal‐
56 lation of packages specified according to the pattern @mycorp/package.
57
58 This will also cause npm init to create a scoped package.
59
60 # accept all defaults, and create a package named "@foo/whatever",
61 # instead of just named "whatever"
62 npm init --scope=@foo --yes
63
64 auth-type
65 • Default: "web"
66
67 • Type: "legacy" or "web"
68
69
70 What authentication strategy to use with login. Note that if an otp
71 config is given, this value will always be set to legacy.
72
73 See Also
74 • npm help registry
75
76 • npm help config
77
78 • npm help npmrc
79
80 • npm help owner
81
82 • npm help whoami
83
84 • npm help token
85
86 • npm help profile
87
88
89
90 November 2023 NPM-LOGIN(1)