vuejs/vue-cli · error · Error

remote / local preset does not contain preset.json!

Error message

remote / local preset does not contain preset.json!

What it means

Thrown by loadPresetFromDir when the specified directory does not contain a preset.json file. The function expects a directory structure with at least a preset.json describing the preset configuration; its absence means the directory is not a valid Vue CLI preset.

Source

Thrown at packages/@vue/cli/lib/util/loadPresetFromDir.js:7

const path = require('path')
const fs = require('fs-extra')

module.exports = async function loadPresetFromDir (dir) {
  const presetPath = path.join(dir, 'preset.json')
  if (!fs.existsSync(presetPath)) {
    throw new Error('remote / local preset does not contain preset.json!')
  }
  const preset = await fs.readJson(presetPath)

  // if the preset dir contains generator.js or generator/index.js, we will inject it as a hidden
  // plugin so it will be invoked by the generator.
  const hasGenerator = fs.existsSync(path.join(dir, 'generator.js')) || fs.existsSync(path.join(dir, 'generator/index.js'))
  if (hasGenerator) {
    (preset.plugins || (preset.plugins = {}))[dir.replace(/[/]$/, '')] = {
      _isPreset: true,
      prompts: true
    }
  }

  return preset
}

View on GitHub (pinned to 7eb93c169c)

Solutions

  1. Ensure the target directory contains a preset.json file: `ls <dir>/preset.json`.
  2. For remote presets, verify the repository has preset.json at the root (or correct subdirectory).
  3. Create a preset.json in the directory if you intend it to be a preset — it should contain at minimum `{"plugins": {}}`.

Example fix

# before
$ ls my-preset-dir/
  generator.js  prompts.js   # no preset.json
$ vue create app --preset ./my-preset-dir
Error: does not contain preset.json!
# after
$ echo '{"plugins":{"@vue/cli-plugin-babel":{}}}' > my-preset-dir/preset.json
$ vue create app --preset ./my-preset-dir
Defensive patterns

Strategy: validation

Validate before calling

const { existsSync } = require('fs');
const path = require('path');
if (!existsSync(path.join(dir, 'preset.json'))) {
  console.error(`No preset.json found in ${dir}. A preset directory must contain preset.json.`);
  process.exit(1);
}

Try / catch

try {
  const preset = await loadPresetFromDir(dir);
} catch (e) {
  if (e.message.includes('preset.json')) {
    console.error(`Directory ${dir} is not a valid preset. Create a preset.json file.`);
    process.exit(1);
  }
  throw e;
}

Prevention

When it happens

Trigger: Calling `vue create --preset <dir>` where <dir> is a valid directory but has no preset.json. Loading a remote/git preset that was cloned/extracted but lacks preset.json.

Common situations: User points to a project directory instead of a preset directory. A git-based or remote preset repository doesn't include preset.json at its root. The preset was partially extracted or the wrong subdirectory was specified.

Related errors


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