{"record":{"id":"5c1fa13501ec5176","repo":"vuejs/vue-cli","slug":"remote-local-preset-does-not-contain-preset-json","errorCode":null,"errorMessage":"remote / local preset does not contain preset.json!","messagePattern":"remote / local preset does not contain preset\\.json!","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@vue/cli/lib/util/loadPresetFromDir.js","lineNumber":7,"sourceCode":"const path = require('path')\nconst fs = require('fs-extra')\n\nmodule.exports = async function loadPresetFromDir (dir) {\n  const presetPath = path.join(dir, 'preset.json')\n  if (!fs.existsSync(presetPath)) {\n    throw new Error('remote / local preset does not contain preset.json!')\n  }\n  const preset = await fs.readJson(presetPath)\n\n  // if the preset dir contains generator.js or generator/index.js, we will inject it as a hidden\n  // plugin so it will be invoked by the generator.\n  const hasGenerator = fs.existsSync(path.join(dir, 'generator.js')) || fs.existsSync(path.join(dir, 'generator/index.js'))\n  if (hasGenerator) {\n    (preset.plugins || (preset.plugins = {}))[dir.replace(/[/]$/, '')] = {\n      _isPreset: true,\n      prompts: true\n    }\n  }\n\n  return preset\n}\n","sourceCodeStart":1,"sourceCodeEnd":23,"githubUrl":"https://github.com/vuejs/vue-cli/blob/7eb93c169c7520935252e2473387f923ef80d856/packages/@vue/cli/lib/util/loadPresetFromDir.js#L1-L23","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Ensure the target directory contains a preset.json file: `ls <dir>/preset.json`.","For remote presets, verify the repository has preset.json at the root (or correct subdirectory).","Create a preset.json in the directory if you intend it to be a preset — it should contain at minimum `{\"plugins\": {}}`."],"exampleFix":"# before\n$ ls my-preset-dir/\n  generator.js  prompts.js   # no preset.json\n$ vue create app --preset ./my-preset-dir\nError: does not contain preset.json!\n# after\n$ echo '{\"plugins\":{\"@vue/cli-plugin-babel\":{}}}' > my-preset-dir/preset.json\n$ vue create app --preset ./my-preset-dir","handlingStrategy":"validation","validationCode":"const { existsSync } = require('fs');\nconst path = require('path');\nif (!existsSync(path.join(dir, 'preset.json'))) {\n  console.error(`No preset.json found in ${dir}. A preset directory must contain preset.json.`);\n  process.exit(1);\n}","typeGuard":null,"tryCatchPattern":"try {\n  const preset = await loadPresetFromDir(dir);\n} catch (e) {\n  if (e.message.includes('preset.json')) {\n    console.error(`Directory ${dir} is not a valid preset. Create a preset.json file.`);\n    process.exit(1);\n  }\n  throw e;\n}","preventionTips":["Ensure every preset directory contains a preset.json file.","For remote/git presets, verify preset.json exists at the repository root before referencing.","Validate preset structure before sharing or deploying."],"tags":["preset","filesystem","validation","create","configuration"],"backgroundTag":null,"analyzedSha":"7eb93c169c7520935252e2473387f923ef80d856","analyzedAt":"2026-08-13T10:13:37.803Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}