Skip to content

Commit 5e3ccd5

Browse files
committed
changes to npm publish
1 parent da188ea commit 5e3ccd5

File tree

6 files changed

+46
-0
lines changed

6 files changed

+46
-0
lines changed

content/cli/v10/commands/npm-publish.mdx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ npm publish <package-spec>
2929

3030
Publishes a package to the registry so that it can be installed by name.
3131

32+
**Important:** Publishing to npm requires either:
33+
- Two-factor authentication (2FA) enabled on your account, OR
34+
- A granular access token with bypass 2FA enabled (for CI/CD workflows)
35+
36+
For more information, see the npm documentation on [requiring 2FA for package publishing](https://docs.npmjs.com/requiring-2fa-for-package-publishing-and-settings-modification).
37+
3238
By default npm will publish to the public registry. This can be overridden by specifying a different default registry or using a [`scope`](/cli/v10/using-npm/scope) in the name, combined with a scope-configured registry (see [`package.json`](/cli/v10/configuring-npm/package-json)).
3339

3440
A `package` is interpreted the same way as other commands (like `npm install`) and can be:
@@ -111,6 +117,8 @@ This is a one-time password from a two-factor authenticator. It's needed when pu
111117

112118
If not set, and a registry response fails with a challenge for a one-time password, npm will prompt on the command line for one.
113119

120+
**Note:** As an alternative to using 2FA with OTP, you can publish using a granular access token with bypass 2FA enabled. This is commonly used in CI/CD workflows where interactive authentication is not possible.
121+
114122
#### `workspace`
115123

116124
- Default:

content/cli/v11/commands/npm-publish.mdx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ npm publish <package-spec>
4545

4646
Publishes a package to the registry so that it can be installed by name.
4747

48+
**Important:** Publishing to npm requires either:
49+
- Two-factor authentication (2FA) enabled on your account, OR
50+
- A granular access token with bypass 2FA enabled (for CI/CD workflows)
51+
52+
For more information, see the npm documentation on [requiring 2FA for package publishing](https://docs.npmjs.com/requiring-2fa-for-package-publishing-and-settings-modification).
53+
4854
By default npm will publish to the public registry. This can be overridden by specifying a different default registry or using a [`scope`](/cli/v11/using-npm/scope) in the name, combined with a scope-configured registry (see [`package.json`](/cli/v11/configuring-npm/package-json)).
4955

5056
A `package` is interpreted the same way as other commands (like `npm install`) and can be:
@@ -129,6 +135,8 @@ This is a one-time password from a two-factor authenticator. It's needed when pu
129135

130136
If not set, and a registry response fails with a challenge for a one-time password, npm will prompt on the command line for one.
131137

138+
**Note:** As an alternative to using 2FA with OTP, you can publish using a granular access token with bypass 2FA enabled. This is commonly used in CI/CD workflows where interactive authentication is not possible.
139+
132140
#### `workspace`
133141

134142
- Default:

content/cli/v6/commands/npm-publish.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ Sets tag 'latest' if no --tag specified
3232
3333
Publishes a package to the registry so that it can be installed by name. All files in the package directory are included if no local `.gitignore` or `.npmignore` file exists. If both files exist and a file is ignored by `.gitignore` but not by `.npmignore` then it will be included. See [`developers`](/cli/v6/using-npm/developers) for full details on what's included in the published package, as well as details on how the package is built.
3434
35+
**Important:** Publishing to npm requires either:
36+
- Two-factor authentication (2FA) enabled on your account, OR
37+
- A granular access token with bypass 2FA enabled (for CI/CD workflows)
38+
39+
For more information, see the npm documentation on [requiring 2FA for package publishing](https://docs.npmjs.com/requiring-2fa-for-package-publishing-and-settings-modification).
40+
3541
By default npm will publish to the public registry. This can be overridden by specifying a different default registry or using a [`scope`](/cli/v6/using-npm/scope) in the name (see [`package.json`](/cli/v6/configuring-npm/package-json)).
3642
3743
- `<folder>`: A folder containing a package.json file

content/cli/v7/commands/npm-publish.mdx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ Sets tag 'latest' if no --tag specified
3232
3333
Publishes a package to the registry so that it can be installed by name.
3434
35+
**Important:** Publishing to npm requires either:
36+
- Two-factor authentication (2FA) enabled on your account, OR
37+
- A granular access token with bypass 2FA enabled (for CI/CD workflows)
38+
39+
For more information, see the npm documentation on [requiring 2FA for package publishing](https://docs.npmjs.com/requiring-2fa-for-package-publishing-and-settings-modification).
40+
3541
By default npm will publish to the public registry. This can be overridden by specifying a different default registry or using a [`scope`](/cli/v7/using-npm/scope) in the name (see [`package.json`](/cli/v7/configuring-npm/package-json)).
3642
3743
- `<folder>`: A folder containing a package.json file
@@ -116,6 +122,8 @@ This is a one-time password from a two-factor authenticator. It's needed when pu
116122
117123
If not set, and a registry response fails with a challenge for a one-time password, npm will prompt on the command line for one.
118124
125+
**Note:** As an alternative to using 2FA with OTP, you can publish using a granular access token with bypass 2FA enabled. This is commonly used in CI/CD workflows where interactive authentication is not possible.
126+
119127
#### `workspace`
120128
121129
- Default:

content/cli/v8/commands/npm-publish.mdx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ npm publish <package-spec>
2929

3030
Publishes a package to the registry so that it can be installed by name.
3131

32+
**Important:** Publishing to npm requires either:
33+
- Two-factor authentication (2FA) enabled on your account, OR
34+
- A granular access token with bypass 2FA enabled (for CI/CD workflows)
35+
36+
For more information, see the npm documentation on [requiring 2FA for package publishing](https://docs.npmjs.com/requiring-2fa-for-package-publishing-and-settings-modification).
37+
3238
By default npm will publish to the public registry. This can be overridden by specifying a different default registry or using a [`scope`](/cli/v8/using-npm/scope) in the name, combined with a scope-configured registry (see [`package.json`](/cli/v8/configuring-npm/package-json)).
3339

3440
A `package` is interpreted the same way as other commands (like `npm install` and can be:
@@ -107,6 +113,8 @@ This is a one-time password from a two-factor authenticator. It's needed when pu
107113

108114
If not set, and a registry response fails with a challenge for a one-time password, npm will prompt on the command line for one.
109115

116+
**Note:** As an alternative to using 2FA with OTP, you can publish using a granular access token with bypass 2FA enabled. This is commonly used in CI/CD workflows where interactive authentication is not possible.
117+
110118
#### `workspace`
111119

112120
- Default:

content/cli/v9/commands/npm-publish.mdx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ npm publish <package-spec>
2929

3030
Publishes a package to the registry so that it can be installed by name.
3131

32+
**Important:** Publishing to npm requires either:
33+
- Two-factor authentication (2FA) enabled on your account, OR
34+
- A granular access token with bypass 2FA enabled (for CI/CD workflows)
35+
36+
For more information, see the npm documentation on [requiring 2FA for package publishing](https://docs.npmjs.com/requiring-2fa-for-package-publishing-and-settings-modification).
37+
3238
By default npm will publish to the public registry. This can be overridden by specifying a different default registry or using a [`scope`](/cli/v9/using-npm/scope) in the name, combined with a scope-configured registry (see [`package.json`](/cli/v9/configuring-npm/package-json)).
3339

3440
A `package` is interpreted the same way as other commands (like `npm install` and can be:
@@ -109,6 +115,8 @@ This is a one-time password from a two-factor authenticator. It's needed when pu
109115

110116
If not set, and a registry response fails with a challenge for a one-time password, npm will prompt on the command line for one.
111117

118+
**Note:** As an alternative to using 2FA with OTP, you can publish using a granular access token with bypass 2FA enabled. This is commonly used in CI/CD workflows where interactive authentication is not possible.
119+
112120
#### `workspace`
113121

114122
- Default:

0 commit comments

Comments
 (0)