affaan-m/ECC · error · Error

ECC_NASIKO_CLI_EXECUTABLE must be an absolute path.

Error message

ECC_NASIKO_CLI_EXECUTABLE must be an absolute path.

What it means

resolveExecutable builds the path to the Nasiko CLI binary. When the ECC_NASIKO_CLI_EXECUTABLE environment variable (or a configured candidate) is a relative path, the script refuses to proceed because relative executable paths resolve unpredictably against the process CWD. It throws to force an unambiguous absolute path.

Solutions

  1. Set ECC_NASIKO_CLI_EXECUTABLE to a fully absolute path, e.g. /usr/local/bin/nasiko.
  2. Expand ~ and $HOME in your shell config before exporting: export ECC_NASIKO_CLI_EXECUTABLE="$HOME/bin/nasiko".
  3. Alternatively unset the env var so the script falls back to defaultExecutablePath().
  4. Use `readlink -f "$(which nasiko)"` to obtain an absolute path.

Example fix

// before
export ECC_NASIKO_CLI_EXECUTABLE=./dist/nasiko
// after
export ECC_NASIKO_CLI_EXECUTABLE="$PWD/dist/nasiko"
Defensive patterns

Strategy: validation

Validate before calling

const exe = process.env.ECC_NASIKO_CLI_EXECUTABLE;
if (exe && !require('path').isAbsolute(exe)) throw new Error(`Set ECC_NASIKO_CLI_EXECUTABLE to an absolute path, got: ${exe}`);

Type guard

const isAbsoluteExecPath = (v) => typeof v === 'string' && v.length > 0 && require('path').isAbsolute(v);

Try / catch

try {
  readStatus();
} catch (err) {
  if (err.message.includes('must be an absolute path')) {
    console.error('Fix ECC_NASIKO_CLI_EXECUTABLE: use path.resolve()/an absolute path.');
  } else throw err;
}

Prevention

When it happens

Trigger: Setting ECC_NASIKO_CLI_EXECUTABLE to a relative value like './bin/nasiko' or 'nasiko-cli' (something not found on PATH via defaultExecutablePath), then calling readStatus/readInstall/uninstall which call resolveExecutable.

Common situations: Configuring the env var in .envrc or CI with a shell-relative path; assuming the script resolves paths against the repo root; moving a binary and updating the env var with a shortcut like '~/bin/nasiko' typoed as a relative fragment.

Understand the failure class

Background: "is not a valid" / "Invalid ... value" environment variable errors: how libraries validate env vars and what to do when they reject yours — this error's family across 48 libraries.

Related errors


AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16). Data as JSON: /api/errors/64642923e9d66e7c. Report an issue: GitHub.

Appendix: source

Thrown at scripts/nasiko.js:75

function defaultExecutablePath() {
  const normalized = normalizePlatform();
  if (normalized.os === 'windows') {
    return process.env.LOCALAPPDATA
      ? path.join(process.env.LOCALAPPDATA, 'nasiko', 'bin', normalized.binaryName)
      : null;
  }
  return path.join(os.homedir(), '.local', 'bin', normalized.binaryName);
}

function resolveExecutable(options = {}) {
  const configured = process.env.ECC_NASIKO_CLI_EXECUTABLE;
  const normalized = normalizePlatform();
  const candidate = options.installDir
    ? path.join(validateInstallDirectory(options.installDir), normalized.binaryName)
    : configured || defaultExecutablePath();
  if (!candidate) return null;
  if (!path.isAbsolute(candidate)) {
    throw new Error('ECC_NASIKO_CLI_EXECUTABLE must be an absolute path.');
  }
  return candidate;
}

function readStatus(options = {}) {
  const executable = resolveExecutable(options);
  if (!executable) return { installed: false, qualified: false, version: null, executable: null };
  return inspectInstalledNasiko(executable);
}

function parseStatusArguments(argumentsList) {
  let options = { installDir: undefined, json: false };
  for (let index = 0; index < argumentsList.length; index += 1) {
    const argument = argumentsList[index];
    if (argument === '--json') options = { ...options, json: true };
    else if (argument === '--install-dir') {
      const value = argumentsList[index + 1];
      if (!value || value.startsWith('--')) throw new Error('Missing value for --install-dir.');

View on GitHub (pinned to 8321021c54)