vuejs/vue-cli · error · Error

Invalid local preset path: ${path}

Error message

Invalid local preset path: ${path}

What it means

Thrown by loadLocalPreset when the given path is neither a regular file nor a directory — fs.statSync succeeds but the stats object reports neither isFile() nor isDirectory(). This is an edge case that typically indicates an unusual file system entry such as a symbolic link to a special file, a device node, or a broken/inaccessible path.

Source

Thrown at packages/@vue/cli/lib/util/loadLocalPreset.js:11

const fs = require('fs-extra')
const loadPresetFromDir = require('./loadPresetFromDir')

module.exports = async function loadLocalPreset (path) {
  const stats = fs.statSync(path)
  if (stats.isFile()) {
    return await fs.readJson(path)
  } else if (stats.isDirectory()) {
    return await loadPresetFromDir(path)
  } else {
    throw new Error(`Invalid local preset path: ${path}`)
  }
}

View on GitHub (pinned to 7eb93c169c)

Solutions

  1. Verify the preset path points to a real file (a .json preset) or a directory containing preset.json: `ls -la <path>`.
  2. If using a symlink, ensure it resolves to a valid file or directory: `readlink -f <path>`.
  3. Use an absolute path to avoid ambiguity with relative resolution.

Example fix

# before
$ vue create my-app --preset /tmp/broken-symlink
Error: Invalid local preset path
# after
$ ls -la /path/to/preset.json
$ vue create my-app --preset /path/to/preset.json
Defensive patterns

Strategy: validation

Validate before calling

const fs = require('fs');
const stats = fs.statSync(presetPath);
if (!stats.isFile() && !stats.isDirectory()) {
  console.error(`Invalid preset path: ${presetPath} is not a file or directory.`);
  process.exit(1);
}

Try / catch

try {
  const preset = await loadLocalPreset(presetPath);
} catch (e) {
  if (e.message.includes('Invalid local preset path')) {
    console.error(`Preset path ${presetPath} is not a valid file or directory.`);
    process.exit(1);
  }
  throw e;
}

Prevention

When it happens

Trigger: Calling `vue create --preset <path>` where the path resolves to something that is not a standard file or directory (e.g., a FIFO, socket, device file, or a symlink to one).

Common situations: User passes a path to a special file by accident. A symlink points to a removed target, or to a non-file/directory inode. Very rare in normal development; more likely in scripted or automated environments where paths are dynamically generated.

Related errors


AI-assisted analysis of vuejs/vue-cli@7eb93c169c (2026-08-13). Data as JSON: /api/errors/34284ba9646a3588. Report an issue: GitHub.