abpframework/abp · error · CliUsageException

Specified directory does not exist.

Error message

Specified directory does not exist.

What it means

JavaScriptServiceProxyGenerator.CheckWorkDirectory mirrors the C# generator's first check: Directory.Exists(directory) is false, so the work directory supplied to the JS/TS proxy generator does not exist on disk.

Source

Thrown at framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ServiceProxying/JavaScript/JavaScriptServiceProxyGenerator.cs:79

    {
        return ServiceType.Application;
    }

    private void RemoveProxy(GenerateProxyArgs args, string filePath)
    {
        if (File.Exists(filePath))
        {
            File.Delete(filePath);
        }

        Logger.LogInformation($"Delete {GetLoggerOutputPath(filePath, args.WorkDirectory)}");
    }

    private static void CheckWorkDirectory(string directory)
    {
        if (!Directory.Exists(directory))
        {
            throw new CliUsageException("Specified directory does not exist.");
        }

        var projectFiles = Directory.GetFiles(directory, "*.csproj");
        if (!projectFiles.Any())
        {
            throw new CliUsageException(
                "No project file found in the directory. The working directory must have a Web project file.");
        }
    }

    private static string RemoveInitializedEventTrigger(string script)
    {
        return script.Replace(EventTriggerScript, string.Empty);
    }
}

View on GitHub (pinned to 7ed43b1931)

Solutions

  1. Verify the directory exists: 'ls <work-directory>'.
  2. Use an absolute path for --work-directory.
  3. Run from inside the Web project folder without --work-directory so cwd is used.

Example fix

// before
abp generate-proxy -t js -wd ./Acme.App.Web
// after
abp generate-proxy -t js -wd /repo/src/Acme.App.Web
Defensive patterns

Strategy: validation

Validate before calling

if (!Directory.Exists(workDirectory))
{ Console.Error.WriteLine($"Work directory '{workDirectory}' does not exist."); return; }

Prevention

When it happens

Trigger: Running 'abp generate-proxy -t js' (or ts) with a --work-directory that does not exist, or running from a deleted/renamed folder.

Common situations: Typo in path; relative path resolved against an unexpected cwd; directory removed by a clean step; CI checkout mismatch.

Related errors


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