summaryrefslogtreecommitdiff
path: root/doc/user/packages/npm_registry/index.md
diff options
context:
space:
mode:
Diffstat (limited to 'doc/user/packages/npm_registry/index.md')
-rw-r--r--doc/user/packages/npm_registry/index.md26
1 files changed, 26 insertions, 0 deletions
diff --git a/doc/user/packages/npm_registry/index.md b/doc/user/packages/npm_registry/index.md
index 2a1c12c2afd..f15b31d8b67 100644
--- a/doc/user/packages/npm_registry/index.md
+++ b/doc/user/packages/npm_registry/index.md
@@ -286,6 +286,22 @@ By default, when an NPM package is not found in the GitLab NPM Registry, the req
Administrators can disable this behavior in the [Continuous Integration settings](../../admin_area/settings/continuous_integration.md).
+### Installing packages from other organizations
+
+You can route package requests to organizations and users outside of GitLab.
+
+To do this, add lines to your `.npmrc` file, replacing `my-org` with the namespace or group that owns your project's repository. The name is case-sensitive and must match the name of your group or namespace exactly.
+
+```shell
+@foo:registry=https://gitlab.example.com/api/v4/packages/npm/
+//gitlab.com/api/v4/packages/npm/:_authToken= "<your_token>"
+//gitlab.com/api/v4/projects/<your_project_id>/packages/npm/:_authToken= "<your_token>"
+
+@my-other-org:registry=https://gitlab.example.com/api/v4/packages/npm/
+//gitlab.com/api/v4/packages/npm/:_authToken= "<your_token>"
+//gitlab.com/api/v4/projects/<your_project_id>/packages/npm/:_authToken= "<your_token>"
+```
+
## Removing a package
In the packages view of your project page, you can delete packages by clicking
@@ -340,6 +356,13 @@ with your personal access token or deploy token):
//gitlab.com/api/v4/projects/:_authToken=<your_token>
```
+You can also use `yarn config` instead of `npm config` when setting your auth-token dynamically:
+
+```shell
+yarn config set '//gitlab.com/api/v4/projects/<your_project_id>/packages/npm/:_authToken' "<your_token>"
+yarn config set '//gitlab.com/api/v4/packages/npm/:_authToken' "<your_token>"
+```
+
### `npm publish` targets default NPM registry (`registry.npmjs.org`)
Ensure that your package scope is set consistently in your `package.json` and `.npmrc` files.
@@ -418,5 +441,8 @@ npm dist-tag rm @scope/package@version my-tag # Delete a tag from the package
npm install @scope/package@my-tag # Install a specific tag
```
+NOTE: **Note:**
+You cannot use your `CI_JOB_TOKEN` or deploy token with the `npm dist-tag` commands. View [this issue](https://gitlab.com/gitlab-org/gitlab/-/issues/258835) for details.
+
CAUTION: **Warning:**
Due to a bug in NPM 6.9.0, deleting dist tags fails. Make sure your NPM version is greater than 6.9.1.