Install an npm package from a private registry with the ServiceNow IDE

  • Release version: Australia
  • Updated March 12, 2026
  • 2 minutes to read
  • Install Node Package Manager (npm) packages from a private registry as dependencies in your application to use them as third-party libraries.

    Before you begin

    Role required: admin

    About this task

    To install packages from private registries, you must configure your Package Manager user settings in the ServiceNow IDE. Then you can choose in which applications to install packages.

    ServiceNow IDE uses the public npm registry (https://registry.npmjs.org) as its default package source. If your network blocks access to this registry, you must have access to an alternate registry to download packages and build applications in the ServiceNow IDE. If access to the public npm registry is blocked on your system, you must configure a private npm registry in your Package Manager user settings in the ServiceNow IDE.

    Note:
    To install packages from a private registry, the registry must respond with the HTTP Access-Control-Allow-Origin header.

    Procedure

    1. Navigate to All > App Development > ServiceNow IDE.
    2. Open a workspace.
    3. Use one of the following keyboard shortcuts to open the command palette:
      • Windows: Ctrl-Shift-P
      • Mac: Cmd-Shift-P
    4. Enter Preferences: Open User Settings (JSON) and press Enter.
    5. Specify a private registry as the default registry or a scoped registry from which you can install packages.
      OptionExample
      Default registry
      "package-manager.defaultRegistry": "<private-registry-url>",
      Scoped registry
      "package-manager.scopedRegistries": [
              {
                  "scope": "@<scope>",
                  "registry": "<private-registry-url>"
              },
              ...
      ]
      
      Note:
      To install packages from public registries, you can specify a public registry as the default registry or a scoped registry in addition to any private registries.
    6. Provide your credentials for accessing the private registry.
      OptionDescription
      Basic authentication Provide a user name and password to access the default registry that you specified.
      "package-manager.basicAuth": [
          {
              "registry": "<private-registry-url>",
              "user": "<user-name>",
              "pass": "<password>"
          },
          ...
      ]
      Legacy authentication Provide a legacy token to access the default registry that you specified. Legacy tokens are basic authentication credentials encoded in Base64 format.
      "package-manager.legacyAuth": [
          {
              "registry": "<private-registry-url>",
              "token": "<legacy-token>"
          },
          ...
      ] 
      Token authentication Provide a bearer token to access the default registry that you specified.
      "package-manager.tokenAuth": [
          {
              "registry": "<private-registry-url>",
              "token": "<token>"
          },
          ...
      ] 
    7. Save your changes to the settings.json file.
    8. Install packages from the configured registries.
      1. Use one of the following keyboard shortcuts to open the command palette:
        • Windows: Ctrl-Shift-P
        • Mac: Cmd-Shift-P
      2. Enter Package Manager: Install Dependencies and press Enter.
      3. Select an application to install packages in as dependencies.
      Packages are installed in the node_modules directory.

    User settings for private registry access

    In the following example, a user configured access to a private registry using basic authentication. The user also configured their settings to install packages from a public registry with the @example scope.

    {
        "files.autoSave": "off",
        "package-manager.defaultRegistry": "<private-registry-url>",
        "package-manager.basicAuth": [
            {
            "registry": "<private-registry-url>",
                "user": "<user-name>",
                "pass": "<password>"
            }
        ],
        "package-manager.scopedRegistries": [
            {
                "scope": "@example",
                "registry": "<public-registry-url>"
            }
        ]
    }
    

    What to do next

    Use the packages that you installed as third-party libraries in your application. For more information, see Use third-party libraries in applications in the ServiceNow IDE.