{"record":{"id":"55bcf61b4e611907","repo":"tailwindlabs/heroicons","slug":"you-re-trying-to-import-heroicons-react-solid","errorCode":null,"errorMessage":"You're trying to import `@heroicons/react/solid/${property}` from Heroicons v1 but have installed Heroicons v2. Install `@heroicons/react@v1` to resolve this error.","messagePattern":"You're trying to import `@heroicons/react/solid/(.+?)` from Heroicons v1 but have installed Heroicons v2\\. Install `@heroicons/react@v1` to resolve this error\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"react/solid/index.js","lineNumber":9,"sourceCode":"let proxy = new Proxy(\n  {},\n  {\n    get: (obj, property) => {\n      if (property === '__esModule') {\n        return {}\n      }\n\n      throw new Error(\n        `You\\'re trying to import \\`@heroicons/react/solid/${property}\\` from Heroicons v1 but have installed Heroicons v2. Install \\`@heroicons/react@v1\\` to resolve this error.`\n      )\n    },\n  }\n)\n\nmodule.exports = proxy\n","sourceCodeStart":1,"sourceCodeEnd":17,"githubUrl":"https://github.com/tailwindlabs/heroicons/blob/616b7a4dbbf3d011760af8066262cd5c6b3868f3/react/solid/index.js#L1-L17","documentation":"Same v1-vs-v2 compatibility guard as the outline variant, but for the `solid` style: `@heroicons/react/solid/<Icon>` is a throwing Proxy in v2. The v1 default-export-per-file layout is no longer supported; v2 uses named exports from size/style directories.","triggerScenarios":"`import BeakerIcon from '@heroicons/react/solid/BeakerIcon'` or any property access through `@heroicons/react/solid` while heroicons v2 is installed. The `solid/index.js` Proxy get trap throws naming the requested icon.","commonSituations":"Migrating a large v1 codebase where solid icons were imported per-file; copy-pasted Stack Overflow/docs snippets from the v1 era; monorepo packages pinned at different heroicons majors; component libraries built against v1 being consumed in a v2 app.","solutions":["Rewrite to `import { BeakerIcon } from '@heroicons/react/24/solid'` (pick 16/20/24 size).","Or install v1 explicitly if migration is not feasible: `npm install @heroicons/react@v1`.","Codemod all `solid/<Icon>` imports; note v2 uses named exports, not default exports.","Align heroicons versions across workspace packages so no consumer resolves the v2 shims."],"exampleFix":"// before\nimport BeakerIcon from '@heroicons/react/solid/BeakerIcon'\n\n// after\nimport { BeakerIcon } from '@heroicons/react/24/solid'","handlingStrategy":"validation","validationCode":"// fail fast if v1 solid paths are used with v2\nimport { version } from '@heroicons/react/package.json'\nif (version.startsWith('2.')) {\n  // ensure no static import from '@heroicons/react/solid/...' exists\n  console.assert(!import.meta.env || true, 'migrate /solid/<Icon> imports to @heroicons/react/24/solid')\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Lock the heroicons major and regenerate the lockfile on upgrades.","Codemod '/solid/<Icon>' default imports to named imports from '@heroicons/react/24/solid'.","Add lint rule restricting '@heroicons/react/solid' as an import prefix.","Keep shared component libraries on the same heroicons major as consumers."],"tags":["import","version-mismatch","breaking-change","migration","react"],"backgroundTag":"heroicons-v1-v2-import-mismatch","analyzedSha":"616b7a4dbbf3d011760af8066262cd5c6b3868f3","analyzedAt":"2026-08-31T21:42:00.885Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}