Updated on 2026-08-10 GMT+08:00

Uploading and Downloading an npm Package via the Client

CodeArts Artifact can connect to local npm clients. You may upload your private packages from your local npm client to self-hosted repos and share them with others, who can download these npm packages through their clients.

npm Package

Node Package Manager (npm) artifacts are packages published through the npm package manager for the JavaScript runtime environment Node.js.

Constraints

The repository password for a self-hosted repo is account-specific. If you are prompted for a password while using a different account, download the configuration file from the repository's Tutorial tab to obtain it.

Prerequisites

Uploading an npm Package via the Client

  1. Access self-hosted repos using your Huawei Cloud account.
  2. In the left pane, click the name of the repository to be connected to your local development environment.
  3. Click Tutorial on the right of the page.
  4. In the displayed dialog box, click Download Configuration File to download the npmrc file, and save it as the .npmrc file.

  5. Copy the file to the user directory. In Linux, the path is ~/.npmrc (C:\Users\<UserName>\.npmrc).
  6. Go to the npm project directory (where the package.json file is stored), open the package.json file, and add the URL information entered during repository creation to the value of the name field.

  7. Upload the npm package to the registry.

    npm config set strict-ssl false
    npm publish

Downloading an npm Package via the Client

The client tool is npm. Ensure that node.js (or io.js) and npm have been installed.

  1. Access self-hosted repos using your Huawei Cloud account.
  2. Select the target npm registry on the self-hosted repo page.
  3. Click Tutorial on the right of the page.
  4. In the displayed dialog box, click Download Configuration File to download the npmrc file.
  5. Save the downloaded npmrc file as the .npmrc file.

  6. Copy the file to the user directory. In Linux, the path is ~/.npmrc. In Windows, the path is C:\Users\<UserName>\.npmrc.
  7. Go to the npm project directory (where the package.json file is stored) and run the following commands to download the npm dependency.

    npm config set strict-ssl false
    npm install ––verbose