abpframework/abp · error · CliUsageException

Specified directory does not exist.

Error message

Specified directory does not exist.

What it means

Thrown by InstallLibsCommand.ExecuteAsync when the working directory (either from the -wd option or the current directory) does not exist on disk. The command resolves the working directory, then calls Directory.Exists() on it before delegating to InstallLibsService. If the path doesn't resolve to a real folder, it throws a CliUsageException with usage info.

Source

Thrown at framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/InstallLibsCommand.cs:38

    public InstallLibsCommand(IInstallLibsService installLibsService)
    {
        InstallLibsService = installLibsService;
        Logger = NullLogger<InstallLibsCommand>.Instance;
    }

    public async Task ExecuteAsync(CommandLineArgs commandLineArgs)
    {
        var workingDirectoryArg = commandLineArgs.Options.GetOrNull(
            Options.WorkingDirectory.Short,
            Options.WorkingDirectory.Long
        );

        var workingDirectory = workingDirectoryArg ?? Directory.GetCurrentDirectory();

        if (!Directory.Exists(workingDirectory))
        {
            throw new CliUsageException(
                "Specified directory does not exist." +
                Environment.NewLine + Environment.NewLine +
                GetUsageInfo()
            );
        }

        await InstallLibsService.InstallLibsAsync(workingDirectory);
    }

    public string GetUsageInfo()
    {
        var sb = new StringBuilder();

        sb.AppendLine("");
        sb.AppendLine("Usage:");
        sb.AppendLine("");
        sb.AppendLine("  abp install-libs");
        sb.AppendLine("");

View on GitHub (pinned to 7ed43b1931)

Solutions

  1. Verify the directory path exists before running: `ls /path/to/project` to confirm
  2. If using -wd, double-check the spelling and use an absolute path to avoid context ambiguity
  3. If relying on current directory, ensure you are in the project root that contains package.json or abp.resourcemapping.js
  4. Run `abp install-libs` from within the project directory without the -wd flag

Example fix

// before
abp install-libs -wd ./wrong/path

// after
abp install-libs -wd /absolute/path/to/MyProject.Web
Defensive patterns

Strategy: validation

Validate before calling

// Resolve and validate the working directory before running install-libs
var workingDirectory = workingDirectoryArg ?? Directory.GetCurrentDirectory();
if (!Directory.Exists(workingDirectory))
{
    Console.Error.WriteLine($"Error: Directory does not exist: {workingDirectory}");
    return;
}

Try / catch

try
{
    await installLibsCommand.ExecuteAsync(commandLineArgs);
}
catch (CliUsageException ex) when (ex.Message.Contains("Specified directory does not exist"))
{
    logger.LogError("The working directory path is invalid. Verify it with: ls <path>");
}

Prevention

When it happens

Trigger: Passing a -wd/--working-directory option pointing to a nonexistent path, or running the command from a deleted/renamed current working directory. `!Directory.Exists(workingDirectory)` evaluates true.

Common situations: Typo in the -wd path, relative path that resolves incorrectly from the current shell context, the directory was deleted or moved between command construction and execution, or a CI pipeline using an outdated workspace path.

Related errors


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