abpframework/abp · error · CliUsageException

'{packageName}' npm package could not be found!

Error message

'{packageName}' npm package could not be found!

What it means

FindNpmPackageInfoAsync GETs www.abp.io/api/app/npmPackage/byName/?name=<packageName> and throws a CliUsageException when the response status is 404 NotFound. A 404 means the package is not registered in the ABP package metadata catalog (which is distinct from the public npm registry). Other non-success codes fall through to RemoteServiceExceptionHandler.

Source

Thrown at framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectNpmPackageAdder.cs:247

        {
            Logger.LogWarning("Cannot detect ABP package version. " + ex.Message);
        }

        return null;
    }

    private async Task<NpmPackageInfo> FindNpmPackageInfoAsync(string packageName)
    {
        var url = $"{CliUrls.WwwAbpIo}api/app/npmPackage/byName/?name=" + packageName;
        var client = CliHttpClientFactory.CreateClient();

        using (var response = await client.GetAsync(url, CliHttpClientFactory.GetCancellationToken()))
        {
            if (!response.IsSuccessStatusCode)
            {
                if (response.StatusCode == HttpStatusCode.NotFound)
                {
                    throw new CliUsageException($"'{packageName}' npm package could not be found!");
                }

                await RemoteServiceExceptionHandler.EnsureSuccessfulHttpResponseAsync(response);
            }

            var responseContent = await response.Content.ReadAsStringAsync();
            return JsonSerializer.Deserialize<NpmPackageInfo>(responseContent);
        }
    }
}

View on GitHub (pinned to 7ed43b1931)

Solutions

  1. Confirm the exact package name on the ABP docs/npm (mind the @abp/* vs @volo/* scope) and re-run.
  2. Upgrade the ABP CLI so its catalog query matches the current package list.
  3. If the package is a plain npm package, install it directly with 'npm install' instead of 'abp add-package'.

Example fix

// before
abp add-package @volo/abp.ng.theme   // wrong scope
// after
abp add-package @volo/abp.ng.theme
Defensive patterns

Strategy: validation

Validate before calling

using var http = new HttpClient();
var resp = await http.GetAsync($"https://www.abp.io/api/app/npmPackage/byName/?name={packageName}");
if (resp.StatusCode == HttpStatusCode.NotFound)
{ Console.Error.WriteLine($"Package '{packageName}' not in ABP catalog."); return; }

Try / catch

try { await ProjectNpmPackageAdder.AddAsync(packageName); }
catch (CliUsageException ex) when (ex.Message.Contains("npm package could not be found"))
{ Console.Error.WriteLine(ex.Message); }

Prevention

When it happens

Trigger: Running 'abp add-package <name>' for an NPM-scoped ABP package whose name is not catalogued, or any call to ProjectNpmPackageAdder.AddAsync with a packageName the server does not recognize.

Common situations: Misspelled package name; package only available in a newer ABP version than the CLI/server catalog; mixing commercial '@abp/...' names with free '@volo/...' namespaces; passing a non-ABP package name to the ABP catalog endpoint.

Related errors


AI-assisted analysis of abpframework/abp@7ed43b1931 (2026-08-13). Data as JSON: /api/errors/fbb2c27a53d27e22. Report an issue: GitHub.