0
0
mirror of https://gitea.com/gitea/docs.git synced 2025-03-17 23:04:17 +00:00
Files
.gitea
docs
i18n
runner
runner_versioned_docs
src
static
versioned_docs
version-1.19
version-1.20
version-1.21
version-1.22
administration
contributing
development
help
installation
usage
actions
packages
alpine.md
cargo.md
chef.md
composer.md
conan.md
conda.md
container.md
cran.md
debian.md
generic.md
go.md
helm.md
maven.md
npm.md
nuget.md
overview.md
pub.md
pypi.md
rpm.md
rubygems.md
storage.md
swift.md
vagrant.md
agit.md
blame.md
blocking-users.md
clone-filter.md
code-owners.md
incoming-email.md
issue-pull-request-templates.md
labels.md
linked-references.md
merge-message-templates.md
multi-factor-authentication.md
permissions.md
profile-readme.md
protected-tags.md
pull-request.md
push.md
repo-mirror.md
template-repositories.md
webhooks.md
actions.md
administration.md
contributing.md
development.md
help.md
index.md
installation.md
packages.md
usage.md
version-1.23
versioned_sidebars
.editorconfig
.gitattributes
.gitignore
.npmrc
LICENSE
Makefile
README.md
babel.config.js
check_outdated.sh
docusaurus.config.js
package-lock.json
package.json
renovate.json5
runner_versions.json
sidebars.js
versions.json
docs/versioned_docs/version-1.22/usage/packages/npm.md

3.3 KiB

date slug sidebar_position
2021-07-20T00:00:00+00:00 npm 70

NPM Package Registry

Publish npm packages for your user or organization.

Requirements

To work with the npm package registry, you need Node.js coupled with a package manager such as Yarn or npm itself.

The registry supports scoped and unscoped packages.

The following examples use the npm tool with the scope @test.

Configuring the package registry

To register the package registry you need to configure a new package source.

npm config set {scope}:registry=https://gitea.example.com/api/packages/{owner}/npm/
npm config set -- '//gitea.example.com/api/packages/{owner}/npm/:_authToken' "{token}"
Parameter Description
scope The scope of the packages.
owner The owner of the package.
token Your personal access token.

For example:

npm config set @test:registry=https://gitea.example.com/api/packages/testuser/npm/
npm config set -- '//gitea.example.com/api/packages/testuser/npm/:_authToken' "personal_access_token"

or without scope:

npm config set registry https://gitea.example.com/api/packages/testuser/npm/
npm config set -- '//gitea.example.com/api/packages/testuser/npm/:_authToken' "personal_access_token"

Publish a package

Publish a package by running the following command in your project:

npm publish

You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first.

Unpublish a package

Delete a package by running the following command:

npm unpublish {package_name}[@{package_version}]
Parameter Description
package_name The package name.
package_version The package version.

For example:

npm unpublish @test/test_package
npm unpublish @test/test_package@1.0.0

Install a package

To install a package from the package registry, execute the following command:

npm install {package_name}
Parameter Description
package_name The package name.

For example:

npm install @test/test_package

Tag a package

The registry supports version tags which can be managed by npm dist-tag:

npm dist-tag add {package_name}@{version} {tag}
Parameter Description
package_name The package name.
version The version of the package.
tag The tag name.

For example:

npm dist-tag add test_package@1.0.2 release

The tag name must not be a valid version. All tag names which are parsable as a version are rejected.

Search packages

The registry supports searching but does not support special search qualifiers like author:gitea.

Supported commands

npm install
npm ci
npm publish
npm unpublish
npm dist-tag
npm view
npm search