Skip to content

Plugin is attempting to use wrong version of tailwind, causing all formatting to fail #322

Open
@martitv

Description

@martitv

What version of Tailwind CSS are you using?

For example: v3.4.13

What build tool (or framework if it abstracts the build tool) are you using?

NextJS v14.2.13

What version of Node.js are you using?

v20.14.0

What browser are you using?

Chrome

What operating system are you using?

Windows

Describe your issue

When I try to format a file in VSCode, I'm getting the following error from prettier:

{
  "filepath": "c:\\MyApp\\src\\page.tsx",
  "parser": "typescript",
  "plugins": [
    "C:\\MyApp\\node_modules\\.pnpm\\[email protected][email protected]\\node_modules\\prettier-plugin-tailwindcss\\dist\\index.mjs"
  ]
}
["ERROR" - 1:06:56 PM] Error formatting document.
["ERROR" - 1:06:56 PM] ENOENT: no such file or directory, open 'C:\MyApp\node_modules\.pnpm\[email protected]\node_modules\tailwindcss\lib\css\preflight.css'
Error: ENOENT: no such file or directory, open 'C:\MyApp\node_modules\.pnpm\[email protected]\node_modules\tailwindcss\lib\css\preflight.css'
    at Object.readFileSync (node:fs:450:20)
    at t.readFileSync (node:electron/js2c/node_init:2:9900)
    at preflight (C:\MyApp\node_modules\.pnpm\[email protected]\node_modules\tailwindcss\lib\corePlugins.js:555:66)
    at registerPlugins (C:\MyApp\node_modules\.pnpm\[email protected]\node_modules\tailwindcss\lib\lib\setupContextUtils.js:815:61)
    at createContext (C:\MyApp\node_modules\.pnpm\[email protected]\node_modules\tailwindcss\lib\lib\setupContextUtils.js:1221:5)
    at eY (file:///C:/MyApp/node_modules/.pnpm/[email protected][email protected]/node_modules/prettier-plugin-tailwindcss/dist/index.mjs:2353:41224)
    at async b2 (file:///C:/MyApp/node_modules/.pnpm/[email protected][email protected]/node_modules/prettier-plugin-tailwindcss/dist/index.mjs:2353:40349)
    at async Object.parse (file:///C:/MyApp/node_modules/.pnpm/[email protected][email protected]/node_modules/prettier-plugin-tailwindcss/dist/index.mjs:2353:48339)
    at async parse4 (file:///C:/MyApp/node_modules/.pnpm/[email protected]/node_modules/prettier/index.mjs:20685:11)
    at async coreFormat (file:///C:/MyApp/node_modules/.pnpm/[email protected]/node_modules/prettier/index.mjs:21146:7)

It looks like the plugin is trying to use a file from tailwind v3.4.11 even though I only have v3.4.13 installed. If I install v3.4.11 and then reinstall v3.4.13 again it works

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions