idahogurl / vs-code-prettier-eslint

A Visual Studio Code Extension to format JavaScript and TypeScript code using the prettier-eslint package.
MIT License
184 stars 46 forks source link

Cannot find package 'prettier-plugin-tailwindcss' #223

Open skyfenton opened 1 month ago

skyfenton commented 1 month ago

Describe the bug Plugin cannot format document, error output in VSCode Output: Error: Could not warm up worker. Formatting a file for the first time may take longer than usual. Message: Cannot find package 'prettier-plugin-tailwindcss' imported from /vscode/vscode-server/bin/linux-x64/dc96b837cf6bb4af9cd736aa3af08cf8279f7685/noop.js Stacktrace: Error: Cannot find package 'prettier-plugin-tailwindcss' imported from /vscode/vscode-server/bin/linux-x64/dc96b837cf6bb4af9cd736aa3af08cf8279f7685/noop.js at new NodeError (file:///workspaces/waller/react-frontend/node_modules/.pnpm/prettier@3.2.5/node_modules/prettier/index.mjs:17822:5) at packageResolve (file:///workspaces/waller/react-frontend/node_modules/.pnpm/prettier@3.2.5/node_modules/prettier/index.mjs:18802:9) at moduleResolve (file:///workspaces/waller/react-frontend/node_modules/.pnpm/prettier@3.2.5/node_modules/prettier/index.mjs:18834:20) at defaultResolve (file:///workspaces/waller/react-frontend/node_modules/.pnpm/prettier@3.2.5/node_modules/prettier/index.mjs:18921:16) at resolve2 (file:///workspaces/waller/react-frontend/node_modules/.pnpm/prettier@3.2.5/node_modules/prettier/index.mjs:18938:12) at importFromFile (file:///workspaces/waller/react-frontend/node_modules/.pnpm/prettier@3.2.5/node_modules/prettier/index.mjs:18953:16) at importFromDirectory (file:///workspaces/waller/react-frontend/node_modules/.pnpm/prettier@3.2.5/node_modules/prettier/index.mjs:23905:10) at importPlugin (file:///workspaces/waller/react-frontend/node_modules/.pnpm/prettier@3.2.5/node_modules/prettier/index.mjs:23917:12) at async loadPluginWithoutCache (file:///workspaces/waller/react-frontend/node_modules/.pnpm/prettier@3.2.5/node_modules/prettier/index.mjs:23921:18) at async Promise.all (index 0)

Running prettier from the command line with "pnpm exec prettier --write ." works as expected.

To Reproduce Run pnpm install -D prettier prettier-plugin-tailwindcss Add "plugins": ["prettier-plugin-tailwindcss"] to .prettierrc file Reload vscode window. See error in VSCode "Prettier Eslint" Output, formatting document does not work.

Expected behavior Worker should be warmed up with no errors, plugin should format document correctly.

Example Project

Versions (please complete the following information):

System Specifications (please complete the following information):

Additional context Node_modules folder is in a subdirectory of the project root (in a monorepo with other folders for other utilities).

sleeyax commented 1 month ago

Same issue with regular NPM. https://github.com/idahogurl/vs-code-prettier-eslint/issues/183 isn't helpful t either.

Ganbin commented 1 month ago

Same issue for me.

ozyx commented 1 month ago

I think you may need to install prettier-eslint as a dev dependency now? From my understanding, this used to come pre-packaged with the VSCode extension but that changed in v6.0 due to reasons. I have the extension working on our project now with

    "eslint": "8.57.0",
    "eslint-plugin-prettier": "5.1.3",
    "prettier": "3.2.5",
    "prettier-eslint": "16.3.0",
sleeyax commented 1 month ago

I think you may need to install prettier-eslint as a dev dependency now? From my understanding, this used to come pre-packaged with the VSCode extension but that changed in v6.0 due to reasons. I have the extension working on our project now with

    "eslint": "8.57.0",
    "eslint-plugin-prettier": "5.1.3",
    "prettier": "3.2.5",
    "prettier-eslint": "16.3.0",

I have the exact same versions as you in package.json dev dependencies and the issue is still there :/ I don't think it's related tbh.

sleeyax commented 1 month ago

I ended up using Format Code Action instead. Works really well, no extra dependencies needed.

github-actions[bot] commented 2 weeks ago

This issue is stale because it has been open for 14 days with no activity.

NullScope commented 1 day ago

Hi, also having the same issue, regular prettier extension works just fine, the same goes for the CLI command, @idahogurl could you please look into this issue?

gomez-git commented 1 day ago

Same issue with prettier-plugin-organize-imports:

{
  "plugins": ["prettier-plugin-organize-imports"]
}