Technology Encyclopedia Home >How to point npm @scope to CODING private artifact library?

How to point npm @scope to CODING private artifact library?

To point an npm @scope to a CODING private artifact library, you need to configure your npm client to use CODING's private registry for the specified scope. Here's how to do it:

  1. Obtain the CODING Registry URL:
    Log in to your CODING instance and navigate to the private artifact library. Find the registry URL provided by CODING, typically in the format:
    https://<your-coding-domain>/npm/<registry-name>/

  2. Configure npm for the Scope:
    Use the npm config set command to associate the @scope with CODING's registry. For example:

    npm config set @your-scope:registry https://<your-coding-domain>/npm/<registry-name>/
    
  3. Authenticate with CODING:
    If CODING requires authentication, log in using the npm login command with the registry URL:

    npm login --registry=https://<your-coding-domain>/npm/<registry-name>/
    

    Provide your CODING credentials when prompted.

  4. Install or Publish Packages:
    After configuration, you can install or publish packages under the @scope directly from CODING's private registry. For example:

    • Install a package:
      npm install @your-scope/package-name
      
    • Publish a package:
      npm publish --registry=https://<your-coding-domain>/npm/<registry-name>/
      

Example:
If your CODING instance is https://coding.example.com and the registry name is my-registry, configure the scope like this:

npm config set @company:registry https://coding.example.com/npm/my-registry/
npm login --registry=https://coding.example.com/npm/my-registry/

For secure and scalable private artifact management, Tencent Cloud provides Tencent Cloud Container Registry (TCR) and Tencent Cloud CodeArtifact, which offer private npm registry capabilities with enterprise-grade security and integration. These services can be used similarly to CODING's private artifact library.