{"record":{"id":"91af183399839bcc","repo":"vuejs/vue","slug":"n-nvue-packages-version-mismatch-n-n-vue-vuev","errorCode":null,"errorMessage":"\\n\\nVue packages version mismatch:\\n\\n- vue@${vueVersion}\\n- ${packageName}@${packageVersion}\\n\\nThis may cause things to work incorrectly. Make sure to use the same version for both.\\n","messagePattern":"\\\\n\\\\nVue packages version mismatch:\\\\n\\\\n- vue@(.+?)\\\\n- (.+?)@(.+?)\\\\n\\\\nThis may cause things to work incorrectly\\. Make sure to use the same version for both\\.\\\\n","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"packages/server-renderer/index.js","lineNumber":8,"sourceCode":"try {\n  var vueVersion = require('vue').version\n} catch (e) {}\n\nvar packageName = require('./package.json').name\nvar packageVersion = require('./package.json').version\nif (vueVersion && vueVersion !== packageVersion) {\n  throw new Error(\n    '\\n\\nVue packages version mismatch:\\n\\n' +\n      '- vue@' +\n      vueVersion +\n      '\\n' +\n      '- ' +\n      packageName +\n      '@' +\n      packageVersion +\n      '\\n\\n' +\n      'This may cause things to work incorrectly. Make sure to use the same version for both.\\n'\n  )\n}\n\nif (process.env.NODE_ENV === 'production') {\n  module.exports = require('./build.prod.js')\n} else {\n  module.exports = require('./build.dev.js')\n}","sourceCodeStart":1,"sourceCodeEnd":26,"githubUrl":"https://github.com/vuejs/vue/blob/9e88707940088cb1f4cd7dd210c9168a50dc347c/packages/server-renderer/index.js#L1-L26","documentation":"Thrown at module-load time by vue-server-renderer's index.js when the resolved 'vue' package version differs from vue-server-renderer's own package.json version. The two packages are tightly coupled (shared internals, SSR compile helpers) and must ship at the same version. This runs synchronously during require(), so it aborts the process before any SSR code executes.","triggerScenarios":"require('vue-server-renderer') when node_modules contains vue@2.6.x and vue-server-renderer@2.7.x (or any mismatched pair). The version read from require('vue').version is compared to the package.json version of the server-renderer.","commonSituations":"A dependency upgrade bumps vue-server-renderer but leaves vue on the old version (or vice versa). npm/yarn dedupe resolves a nested different version. Lockfile drift after a partial upgrade. Using aliasing (webpack resolve.alias) that points vue to a different version than what node_modules resolves.","solutions":["Align both packages to the exact same version: npm install vue@2.7.16 vue-server-renderer@2.7.16 (use the same version string for both).","Delete node_modules and the lockfile, then reinstall to resolve any dedupe drift.","Run `npm ls vue vue-server-renderer` (or pnpm why vue) to find nested conflicting installations and dedupe them.","If using a monorepo, ensure all workspaces resolve vue and vue-server-renderer to the same version via resolutions/overrides."],"exampleFix":"// before (mismatched)\n// package.json: \"vue\": \"2.6.14\", \"vue-server-renderer\": \"2.7.16\"\n\n// after (aligned)\n// package.json: \"vue\": \"2.7.16\", \"vue-server-renderer\": \"2.7.16\"\n// then run: npm install","handlingStrategy":"validation","validationCode":"const vueVersion = require('vue/package.json').version\nconst ssrVersion = require('vue-server-renderer/package.json').version\n\nif (vueVersion !== ssrVersion) {\n  throw new Error(\n    `Refusing to start: vue@${vueVersion} vs vue-server-renderer@${ssrVersion}. ` +\n    `Run: npm install vue@${ssrVersion} vue-server-renderer@${ssrVersion}`\n  )\n}","typeGuard":"function versionsAligned(a: string, b: string): boolean {\n  return a === b\n}","tryCatchPattern":"// Version check throws at require() time — cannot try/catch around a transitive require easily.\n// Validate before requiring:\nconst pkg = name => require(`${name}/package.json`).version\nif (pkg('vue') !== pkg('vue-server-renderer')) {\n  process.exitCode = 1\n  console.error('Fix versions before continuing.')\n} else {\n  require('vue-server-renderer')\n}","preventionTips":["Pin vue and vue-server-renderer to the same exact version in package.json (no caret/tilde).","Add a postinstall script that asserts version equality.","In a monorepo, use resolutions/overrides to force a single vue version.","Run `npm ls vue vue-server-renderer` in CI to detect drift."],"tags":["vue","version-mismatch","server-renderer","ssr","dependency"],"analyzedSha":"9e88707940088cb1f4cd7dd210c9168a50dc347c","analyzedAt":"2026-08-11T22:22:01.295Z","schemaVersion":2},"datasetVersion":"2026-08-12T05:08:24.936Z"}