abpframework/abp · error · CliUsageException

"@abp/ng.schematics" NPM package should be installed to the

Error message

"@abp/ng.schematics" NPM package should be installed to the devDependencies before running this command!

What it means

After confirming package.json exists, CheckNgSchematicsAsync reads devDependencies['@abp/ng.schematics']. If the value is null (package not listed in devDependencies), it throws a CliUsageException. The schematics package is the engine that actually generates Angular proxy code, so its absence makes the command non-functional.

Source

Thrown at framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ServiceProxying/Angular/AngularServiceProxyGenerator.cs:115

    }

    private async Task CheckNgSchematicsAsync()
    {
        var packageJsonPath = $"package.json";

        if (!File.Exists(packageJsonPath))
        {
            throw new CliUsageException(
                "package.json file not found"
            );
        }

        var schematicsVersion =
            (string)JObject.Parse(File.ReadAllText(packageJsonPath))["devDependencies"]?["@abp/ng.schematics"];

        if (schematicsVersion == null)
        {
            throw new CliUsageException(
                "\"@abp/ng.schematics\" NPM package should be installed to the devDependencies before running this command!"
            );
        }

        var parsed = SemanticVersion.TryParse(schematicsVersion.TrimStart('~', '^', 'v'), out var semanticSchematicsVersion);
        if (!parsed)
        {
            Logger.LogWarning("Couldn't determinate version of \"@abp/ng.schematics\" package.");
            return;
        }

        var cliVersion = await _cliVersionService.GetCurrentCliVersionAsync();
        if (semanticSchematicsVersion < cliVersion)
        {
            Logger.LogWarning("\"@abp/ng.schematics\" version is lower than ABP Cli version.");
        }
    }

View on GitHub (pinned to 7ed43b1931)

Solutions

  1. Run 'npm install @abp/ng.schematics --save-dev' (version matching your ABP release).
  2. Run 'abp update' or 'npm install' to restore the dependency tree as defined in package.json.
  3. Verify with 'npm ls @abp/ng.schematics' that the package resolves.

Example fix

// before: package.json devDependencies has no @abp/ng.schematics
// after
npm install @abp/ng.schematics@^7.0.0 --save-dev
Defensive patterns

Strategy: validation

Validate before calling

var json = JObject.Parse(File.ReadAllText("package.json"));
if (json["devDependencies"]?["@abp/ng.schematics"] == null)
{ Console.Error.WriteLine("@abp/ng.schematics missing from devDependencies."); return; }

Type guard

static bool HasNgSchematics(string packageJsonPath)
{
    var j = JObject.Parse(File.ReadAllText(packageJsonPath));
    return j["devDependencies"]?["@abp/ng.schematics"] != null;
}

Prevention

When it happens

Trigger: Running Angular proxy generation in a project whose package.json does not list @abp/ng.schematics under devDependencies (only under dependencies, or not at all).

Common situations: Fresh checkout where 'npm install' has not been run; package removed during dependency cleanup; ABP version mismatch where schematics were renamed; copied package.json missing the devDependency.

Related errors


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