{"record":{"id":"868cd9f5e1e55afe","repo":"vuejs/vue-cli","slug":"error-loading-vue-cli-config-in-package-json-the","errorCode":null,"errorMessage":"Error loading Vue CLI config in package.json: the \"vue\" field should be an object.","messagePattern":"Error loading Vue CLI config in package\\.json: the \"vue\" field should be an object\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@vue/cli-service/lib/util/resolveUserConfig.js","lineNumber":39,"sourceCode":"  fileConfig,\n  fileConfigPath\n}) {\n  if (fileConfig) {\n    if (typeof fileConfig === 'function') {\n      fileConfig = fileConfig()\n    }\n\n    if (!fileConfig || typeof fileConfig !== 'object') {\n      throw new Error(\n        `Error loading ${chalk.bold(fileConfigPath)}: ` +\n        `should export an object or a function that returns object.`\n      )\n    }\n  }\n\n  // package.vue\n  if (pkgConfig && typeof pkgConfig !== 'object') {\n    throw new Error(\n      `Error loading Vue CLI config in ${chalk.bold(`package.json`)}: ` +\n      `the \"vue\" field should be an object.`\n    )\n  }\n\n  let resolved, resolvedFrom\n  if (fileConfig) {\n    const configFileName = path.basename(fileConfigPath)\n    if (pkgConfig) {\n      warn(\n        `\"vue\" field in package.json ignored ` +\n        `due to presence of ${chalk.bold(configFileName)}.`\n      )\n      warn(\n        `You should migrate it into ${chalk.bold(configFileName)} ` +\n        `and remove it from package.json.`\n      )\n    }","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/vuejs/vue-cli/blob/7eb93c169c7520935252e2473387f923ef80d856/packages/@vue/cli-service/lib/util/resolveUserConfig.js#L21-L57","documentation":"As an alternative to vue.config.js, Vue CLI reads a `\"vue\"` field in package.json. That field must be a configuration object; resolveUserConfig rejects any non-object (string, number, array, boolean) so config parsing stays well-defined.","triggerScenarios":"Setting `\"vue\": \"...\"` or `\"vue\": [...]` in package.json instead of an object.","commonSituations":"Putting a config string/array by mistake; copy-paste from a non-Vue-CLI example.","solutions":["Make the `vue` field an object: `\"vue\": { \"publicPath\": \"/app/\" }`.","Prefer vue.config.js to avoid JSON-only constraints."],"exampleFix":"// package.json — before\n\"vue\": [\"@vue/cli-plugin-babel\"]\n// after\n\"vue\": { \"pluginOptions\": {} }","handlingStrategy":"type-guard","validationCode":"const vueField = require('./package.json').vue\nif (vueField != null && (typeof vueField !== 'object' || Array.isArray(vueField))) {\n  throw new Error('package.json \"vue\" field must be an object')\n}","typeGuard":"const isVuePkgField = (v) => v == null || (typeof v === 'object' && v !== null && !Array.isArray(v))","tryCatchPattern":null,"preventionTips":["Keep the package.json `vue` field an object, or move config to vue.config.js.","Don't reuse the `vue` field for a list of plugin names."],"tags":["configuration","package-json","type-validation"],"backgroundTag":null,"analyzedSha":"7eb93c169c7520935252e2473387f923ef80d856","analyzedAt":"2026-08-13T10:13:37.803Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}