dotnet/aspnetcore · error · Error

The package output path ${packageOutputPath} does not exist.

Error message

The package output path ${packageOutputPath} does not exist.

What it means

During the --create-packages action the script checks that the supplied packageOutputPath exists on disk before writing tarballs into it. Unlike --update-versions, --create-packages does not create the directory, so it must already be present.

Source

Thrown at eng/scripts/npm/pack-workspace.mjs:50

if (!intermediateOutputPath) {
  throw new Error('The intermediate output path was not provided.');
}

// Log all the captured process arguments
console.log(`Workspace Path: ${workspacePath}`);
console.log(`Default Package Version: ${defaultPackageVersion}`);
console.log(`Package Output Path: ${packageOutputPath}`);
console.log(`Intermediate Output Path: ${intermediateOutputPath}`);

if (action === '--update-versions') {
  const [packagesToPack, renames] = applyVersions(defaultPackageVersion, workspacePath);
  // Write packagesToPack and renames to a file
  writeJsonSync(resolve(intermediateOutputPath, 'packagesToPack.json'), packagesToPack);
  writeJsonSync(resolve(intermediateOutputPath, 'renames.json'), renames);
} else if (action === '--create-packages') {
  if (!existsSync(packageOutputPath)) {
    throw new Error(`The package output path ${packageOutputPath} does not exist.`);
  }

  // Read packagesToPack and renames from a file
  const packagesToPack = readJsonSync(resolve(intermediateOutputPath, 'packagesToPack.json'));
  const renames = readJsonSync(resolve(intermediateOutputPath, 'renames.json'));
  try {
    createPackages(packagesToPack);
  } finally {
    // Restore the package.json files to their "originals"
    for (const [from, to] of renames) {
      moveSync(from, to, { overwrite: true });
    }
  }
} else {
  throw new Error(`The action ${action} is not supported.`);
}

// For each package to pack run npm pack

View on GitHub (pinned to 3600ca084e)

Solutions

  1. Create the packageOutputPath directory before invoking --create-packages (e.g. mkdir -p or an MSBuild EnsureExists).
  2. Verify the path passed is absolute or correct relative to the script's cwd.
  3. Ensure the --update-versions phase (which typically precedes create-packages) ran successfully and produced the dir.

Example fix

// before
node pack-workspace.mjs --create-packages ./pkg/package.json 8.0.0 missing-dir artifacts/int
// after
fs.mkdirSync('missing-dir', { recursive: true });
node pack-workspace.mjs --create-packages ./pkg/package.json 8.0.0 missing-dir artifacts/int
Defensive patterns

Strategy: validation

Validate before calling

import { existsSync, mkdirSync } from 'fs';
if (action === '--create-packages') {
    if (!existsSync(packageOutputPath)) mkdirSync(packageOutputPath, { recursive: true });
}

Type guard

const dirExists = (p) => typeof p === 'string' && p.length > 0 && existsSync(p);

Try / catch

try {
  require('child_process').execFileSync('node', ['pack-workspace.mjs','--create-packages', ws, ver, outDir, intDir]);
} catch (e) {
  if (/does not exist/.test(e.message)) fs.mkdirSync(outDir, { recursive: true });
  throw e;
}

Prevention

When it happens

Trigger: Running with action --create-packages when packageOutputPath does not exist on the filesystem (pack-workspace.mjs:48-50). Typical when the directory creation step was skipped or the path is wrong.

Common situations: Build orchestration ran --create-packages without first creating/mkdir-ing the output directory; wrong relative path because cwd differs between phases; --update-variants phase that normally creates the dir did not run.

Related errors


AI-assisted analysis of dotnet/aspnetcore@3600ca084e (2026-08-11). Data as JSON: /api/errors/1b3e406de708f448. Report an issue: GitHub.