Commit 1662597d authored by Suzanne Selhorn's avatar Suzanne Selhorn

Merge branch 'npm-install-scope-selhorn' into 'master'

Added info about installing from group

See merge request gitlab-org/gitlab!52034
parents 374e665d e7ef15d3
......@@ -244,7 +244,9 @@ Prerequisites:
- [Authenticate](#authenticate-to-the-package-registry) to the Package Registry.
- Set a [project-level NPM endpoint](#use-the-gitlab-endpoint-for-npm-packages).
- Your NPM package name must be in the format of [@scope/package-name](#package-naming-convention). It must match exactly, including the case.
- Your NPM package name must be in the format of [@scope/package-name](#package-naming-convention).
It must match exactly, including the case. This is different than the
NPM naming convention, but it is required to work with the GitLab Package Registry.
To upload an NPM package to your project, run this command:
......@@ -263,6 +265,9 @@ Prerequisites:
- [Authenticate](#authenticate-to-the-package-registry) to the Package Registry.
- Set a [project-level NPM endpoint](#use-the-gitlab-endpoint-for-npm-packages).
- Your NPM package name must be in the format of [@scope/package-name](#package-naming-convention).
It must match exactly, including the case. This is different than the
NPM naming convention, but it is required to work with the GitLab Package Registry.
To work with NPM commands within [GitLab CI/CD](../../../ci/README.md), you can use
`CI_JOB_TOKEN` in place of the personal access token or deploy token in your commands.
......@@ -297,7 +302,8 @@ the same version more than once, even if it has been deleted.
## Install a package
NPM packages are commonly-installed by using the `npm` or `yarn` commands
in a JavaScript project.
in a JavaScript project. You can install a package from the scope of a project, group,
or instance.
1. Set the URL for scoped packages by running:
......@@ -309,16 +315,16 @@ in a JavaScript project.
1. Ensure [authentication](#authenticate-to-the-package-registry) is configured.
1. In your project, to install a package, run:
1. To install a package in your project, run:
```shell
npm install @my-project-scope/my-package
npm install @my-scope/my-package
```
Or if you're using Yarn:
```shell
yarn add @my-project-scope/my-package
yarn add @my-scope/my-package
```
In [GitLab 12.9 and later](https://gitlab.com/gitlab-org/gitlab/-/issues/55344),
......@@ -456,7 +462,7 @@ If you get this error, ensure that:
- Your token is not expired and has appropriate permissions.
- [Your token does not begin with `-`](https://gitlab.com/gitlab-org/gitlab/-/issues/235473).
- A package with the same name doesn't already exist within the given scope.
- A package with the same name or version doesn't already exist within the given scope.
- The scoped packages URL includes a trailing slash:
- Correct: `//gitlab.example.com/api/v4/packages/npm/`
- Incorrect: `//gitlab.example.com/api/v4/packages/npm`
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment