affaan-m/ECC · error
LOCALAPPDATA is required on Windows.
Error message
LOCALAPPDATA is required on Windows.
What it means
defaultInstallDirectory in scripts/lib/nasiko-release.js derives the Windows install path from the LOCALAPPDATA environment variable (%LOCALAPPDATA%\nasiko\bin) and requires it to be set. On non-Windows this code is never reached (the function returns ~/.local/bin instead). If the process runs on Windows with LOCALAPPDATA absent, there is no safe default and the function refuses to guess.
Source
Thrown at scripts/lib/nasiko-release.js:135
if (response.statusCode !== 200) { response.resume(); reject(new Error(`Nasiko registry returned HTTP ${response.statusCode}.`)); return; }
const chunks = [];
let total = 0;
response.on('data', chunk => {
total += chunk.length;
if (total > maxBytes) request.destroy(new Error('Nasiko registry response exceeded the size limit.'));
else chunks.push(chunk);
});
response.on('end', () => resolve(Buffer.concat(chunks)));
response.on('error', reject);
});
request.setTimeout(options.timeoutMs || 15000, () => request.destroy(new Error('Nasiko registry request timed out.')));
request.on('error', reject);
});
}
function defaultInstallDirectory(normalized, environment = process.env, homeDirectory = os.homedir()) {
if (normalized.os === 'windows') {
if (!environment.LOCALAPPDATA) throw new Error('LOCALAPPDATA is required on Windows.');
return path.join(environment.LOCALAPPDATA, 'nasiko', 'bin');
}
return path.join(homeDirectory, '.local', 'bin');
}
function validateInstallDirectory(directory) {
if (typeof directory !== 'string' || directory.includes('\0') || !path.isAbsolute(directory)) throw new Error('Nasiko install directory must be an absolute path.');
if (/^(?:\\\\|\\\\\?\\|\\\\\.\\)/.test(directory)) throw new Error('Nasiko install directory must be on a local filesystem.');
const resolved = path.resolve(directory);
if (resolved === path.parse(resolved).root) throw new Error('Nasiko cannot install directly into a filesystem root.');
let ancestor = resolved;
while (!fs.existsSync(ancestor)) {
const parent = path.dirname(ancestor);
if (parent === ancestor) throw new Error('Nasiko install directory has no resolvable filesystem ancestor.');
ancestor = parent;
}
const canonical = fs.realpathSync(ancestor);
return path.join(canonical, path.relative(ancestor, resolved));View on GitHub (pinned to 06c5e118c4)
Solutions
- Set LOCALAPPDATA for the process: `$env:LOCALAPPDATA = "$env:USERPROFILE\AppData\Local"` before running the installer
- Or pass an explicit install directory so the default-derivation code path is skipped entirely
- In CI, export LOCALAPPDATA in the job environment block
Example fix
// before: CI shell without user profile env
await installNasiko({ version: 'v0.1.0' }); // throws
// after: pass an explicit directory
await installNasiko({
version: 'v0.1.0',
directory: path.join(os.homedir(), 'AppData', 'Local', 'nasiko', 'bin'),
}); Defensive patterns
Strategy: validation
Validate before calling
if (process.platform === 'win32' && !process.env.LOCALAPPDATA) {
process.env.LOCALAPPDATA = path.join(os.homedir(), 'AppData', 'Local');
}
await installNasiko({ version: 'v0.1.0' }); Type guard
const hasLocalAppData = (env: NodeJS.ProcessEnv): env is NodeJS.ProcessEnv & { LOCALAPPDATA: string } =>
typeof env.LOCALAPPDATA === 'string' && env.LOCALAPPDATA.length > 0; Try / catch
try {
await installNasiko({ version: 'v0.1.0' });
} catch (error) {
if (/LOCALAPPDATA is required/.test(String(error.message))) {
// Set the env var or pass an explicit directory and retry.
}
throw error;
} Prevention
- Export LOCALAPPDATA in CI job env blocks for Windows runners
- Prefer passing an explicit install directory to avoid env-dependent defaults
- Smoke-test installers in stripped-env shells (env -i) to catch env assumptions early
When it happens
Trigger: normalized.os === 'windows' and environment.LOCALAPPDATA is undefined/empty when defaultInstallDirectory runs. Happens in stripped CI shells, scheduled tasks/services running without a user profile, some SSH sessions into Windows, and containers that set only a handful of env vars.
Common situations: GitHub Actions/Jenkins Windows runners with minimal env; Git Bash or MSYS shells where env propagation drops user variables; running installers from a Windows service context; Docker Windows containers without profile initialization.
Understand the failure class
Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.
Related errors
- Nasiko install directory must be on a local filesystem.
- [ECC] ECC_DASHBOARD_HOST must be loopback-only (127.0.0.1, l
- The canonical ito-compute-cli is unpublished and ECC will no
- ${EXECUTABLE_OVERRIDE} must be an absolute path explicitly c
- ${EXECUTABLE_OVERRIDE} does not point to a readable local It
AI-assisted analysis of affaan-m/ECC@06c5e118c4 (2026-08-18).
Data as JSON: /api/errors/762e94aefe38fde7.
Report an issue: GitHub.