remotion-dev/remotion · error

unknown package manager

Error message

unknown package manager

What it means

create-video's getRunCommand maps a PackageManager to its 'run' command prefix (e.g. 'npm run', 'bun run'). The PackageManager union currently includes an unknown/nonstandard value (the code even special-cases 'nub'), and when the manager is not one of the known package managers it throws a TypeError. This indicates a package-manager identifier outside the supported set reached the function.

Source

Thrown at packages/create-video/src/pkg-managers.ts:128

	}

	if (manager === 'yarn') {
		return `yarn run`;
	}

	if (manager === 'pnpm') {
		return `pnpm run`;
	}

	if (manager === 'bun') {
		return `bun run`;
	}

	if (manager === 'nub') {
		return `nub run`;
	}

	throw new TypeError('unknown package manager');
};

export const getRenderCommand = (manager: PackageManager) => {
	if (manager === 'npm') {
		return `npx remotion render`;
	}

	if (manager === 'yarn') {
		return `yarn remotion render`;
	}

	if (manager === 'pnpm') {
		return `pnpm exec remotion render`;
	}

	if (manager === 'bun') {
		return `bunx remotion render`;
	}

View on GitHub (pinned to b2f4e34732)

Solutions

  1. Add a branch for the missing package manager in getRunCommand
  2. Ensure the value passed comes from the supported PackageManager set and is not arbitrary user input
  3. Fix the source that produced the unexpected manager string (env var, CLI arg, prompt)
  4. Check getPackageManager / the detection logic to see why an unsupported manager was returned

Example fix

// before
throw new TypeError('unknown package manager');
// after
if (manager === 'yarn') {
	return `yarn run`;
}
throw new TypeError('unknown package manager');
Defensive patterns

Strategy: type-guard

Validate before calling

const KNOWN_MANAGERS = ['npm','yarn','pnpm','bun','nub'] as const;
if (!KNOWN_MANAGERS.includes(manager as never)) throw new Error('Unsupported manager: ' + manager);

Type guard

const isPackageManager = (v: string): v is PackageManager =>
	['npm','yarn','pnpm','bun','nub'].includes(v);

Try / catch

try {
	cmd = getRunCommand(manager);
} catch (err) {
	if (err instanceof TypeError && err.message === 'unknown package manager') {
		cmd = getRunCommand('npm'); // safe fallback
	} else throw err;
}

Prevention

When it happens

Trigger: Calling getRunCommand with a PackageManager value not handled by the if-chain (e.g. a new manager string like 'yarn' that the chain doesn't cover, or an arbitrary string cast to PackageManager).

Common situations: Adding a new package manager to the union type without updating all command builders; user-input or env-derived manager strings cast unsafely to PackageManager; typos in the manager selection code.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of remotion-dev/remotion@b2f4e34732 (2026-09-09). Data as JSON: /api/errors/c4cabcbfd22801ac. Report an issue: GitHub.