-
Notifications
You must be signed in to change notification settings - Fork 45
Description
I've encountered an issue in my development setup involving Prettier, the prettier-plugin-tailwindcss plugin, and a PNPM monorepo environment. Notably, when I save a file, the expected formatting by Prettier doesn't take place. While there's no immediate error message displayed on save, I unearthed an error in the logs when inspecting with :CocOpenLog.
Logs:
2023-09-16T13:04:14.668 INFO (pid:8252) [core-watchman] - watchman watching project: /Users/tbo/git/project
2023-09-16T13:04:17.447 ERROR (pid:8252) [core-documents] - Error on will save handler: Error: Cannot find package 'prettier-plugin-tailwindcss' imported from /Users/tbo/noop.js
at new NodeError �[90m(file:///Users/tbo/�[39mgit/project/node_modules/�[4m.pnpm�[24m/prettier@3.0.3/node_modules/�[4mprettier�[24m/index.mjs:18797:5�[90m)�[39m
at packageResolve �[90m(file:///Users/tbo/�[39mgit/project/node_modules/�[4m.pnpm�[24m/prettier@3.0.3/node_modules/�[4mprettier�[24m/index.mjs:19742:9�[90m)�[39m
at moduleResolve �[90m(file:///Users/tbo/�[39mgit/project/node_modules/�[4m.pnpm�[24m/prettier@3.0.3/node_modules/�[4mprettier�[24m/index.mjs:19774:20�[90m)�[39m
at defaultResolve �[90m(file:///Users/tbo/�[39mgit/project/node_modules/�[4m.pnpm�[24m/prettier@3.0.3/node_modules/�[4mprettier�[24m/index.mjs:19879:15�[90m)�[39m
at resolve �[90m(file:///Users/tbo/�[39mgit/project/node_modules/�[4m.pnpm�[24m/prettier@3.0.3/node_modules/�[4mprettier�[24m/index.mjs:19897:12�[90m)�[39m
at importFromFile �[90m(file:///Users/tbo/�[39mgit/project/node_modules/�[4m.pnpm�[24m/prettier@3.0.3/node_modules/�[4mprettier�[24m/index.mjs:19912:15�[90m)�[39m
at importFromDirectory �[90m(file:///Users/tbo/�[39mgit/project/node_modules/�[4m.pnpm�[24m/prettier@3.0.3/node_modules/�[4mprettier�[24m/index.mjs:20181:10�[90m)�[39m
at �[90mfile:///Users/tbo/�[39mgit/project/node_modules/�[4m.pnpm�[24m/prettier@3.0.3/node_modules/�[4mprettier�[24m/index.mjs:20198:12
at async loadPlugin �[90m(file:///Users/tbo/�[39mgit/project/node_modules/�[4m.pnpm�[24m/prettier@3.0.3/node_modules/�[4mprettier�[24m/index.mjs:20203:28�[90m)�[39m
at async Promise.all (index 0) {
code: �[32m'ERR_MODULE_NOT_FOUND'�[39m
}
Running the Prettier CLI directly via the command ./node_modules/.bin/prettier ./src/ --write
executes without any hitches, ensuring proper formatting. However, the in-editor save functionality seems to be at odds. A temporary relief can be achieved by restarting CoC using the :CocRestart command. After that, everything works as expected.
This behavior began roughly two weeks ago. I'm inclined to consider that it could be intertwined with recent modifications, potentially those related to the Prettier 3.0 upgrade.