eyaltoledano/claude-task-master · error

Assets directory not found. This is likely a packaging issue

Error message

Assets directory not found. This is likely a packaging issue.

What it means

getAssetsDir walks known candidate locations to find the bundled assets directory (templates, examples, etc.). If none exist — typically because the package was installed or bundled without the assets/ folder — it throws this error. It exists to fail loudly instead of returning a bogus path that later fails with a confusing ENOENT.

Source

Thrown at src/utils/asset-resolver.js:54

			'dist',
			'assets'
		),
		path.join(process.cwd(), 'node_modules', 'task-master-ai', 'assets')
	];

	// Find the first existing assets directory
	for (const assetPath of possiblePaths) {
		if (fs.existsSync(assetPath)) {
			// Verify it's actually the assets directory by checking for known files
			const testFile = path.join(assetPath, 'rules', 'taskmaster.mdc');
			if (fs.existsSync(testFile)) {
				return assetPath;
			}
		}
	}

	// If no assets directory found, throw an error
	throw new Error(
		'Assets directory not found. This is likely a packaging issue.'
	);
}

/**
 * Get path to a specific asset file
 * @param {string} relativePath - Path relative to assets directory
 * @returns {string} Full path to the asset file
 */
export function getAssetPath(relativePath) {
	const assetsDir = getAssetsDir();
	return path.join(assetsDir, relativePath);
}

/**
 * Check if an asset file exists
 * @param {string} relativePath - Path relative to assets directory
 * @returns {boolean} True if the asset exists

View on GitHub (pinned to c0c98d367c)

Solutions

  1. Reinstall the package cleanly (npm cache clean; npm install) so the assets/ directory ships with node_modules
  2. Verify the assets folder exists at the expected location relative to the package root; if missing, restore it from the repository
  3. If bundling, copy assets/ into the output directory (e.g. esbuild --copy-files, webpack CopyPlugin) or mark the package as external
  4. Check package.json 'files' field includes 'assets' so npm publishes it

Example fix

// package.json before
"files": ["index.js"]
// after
"files": ["index.js", "assets"]
Defensive patterns

Strategy: fallback

Validate before calling

const fs = require('fs');
const path = require('path');
const candidates = [
  path.join(__dirname, 'assets'),
  path.join(process.cwd(), 'node_modules', 'task-master-ai', 'assets')
];
const assetsDir = candidates.find((p) => fs.existsSync(p));
if (!assetsDir) throw new Error('Assets missing — reinstall the package');

Try / catch

try {
  const dir = getAssetsDir();
} catch (err) {
  if (err.message.includes('Assets directory not found')) {
    console.error('Installation appears broken. Run: npm cache clean --force && npm install');
    process.exitCode = 1;
  } else throw err;
}

Prevention

When it happens

Trigger: Calling getAssetsDir (or the assetsDir accessor) when no candidate assets directory resolves: package copied without assets/, npm pack/publish pruning files, bundlers (webpack/esbuild) not marking assets as external, installing from a repacked tarball, or global installs missing non-JS files.

Common situations: Distributing the CLI via a bundler and forgetting to copy assets; using pkg/nexe builds that skip non-JS resources; enterprise mirror/proxy stripping extra files; monorepo symlink installs where the relative lookup path changed after a build-layout refactor.

Related errors


AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29). Data as JSON: /api/errors/e3ca3ea333b79797. Report an issue: GitHub.