Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save handler can't find package #169

Open
tbo opened this issue Sep 16, 2023 · 0 comments
Open

Save handler can't find package #169

tbo opened this issue Sep 16, 2023 · 0 comments

Comments

@tbo
Copy link

tbo commented Sep 16, 2023

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/[email protected]/node_modules/�[4mprettier�[24m/index.mjs:18797:5�[90m)�[39m
    at packageResolve �[90m(file:///Users/tbo/�[39mgit/project/node_modules/�[4m.pnpm�[24m/[email protected]/node_modules/�[4mprettier�[24m/index.mjs:19742:9�[90m)�[39m
    at moduleResolve �[90m(file:///Users/tbo/�[39mgit/project/node_modules/�[4m.pnpm�[24m/[email protected]/node_modules/�[4mprettier�[24m/index.mjs:19774:20�[90m)�[39m
    at defaultResolve �[90m(file:///Users/tbo/�[39mgit/project/node_modules/�[4m.pnpm�[24m/[email protected]/node_modules/�[4mprettier�[24m/index.mjs:19879:15�[90m)�[39m
    at resolve �[90m(file:///Users/tbo/�[39mgit/project/node_modules/�[4m.pnpm�[24m/[email protected]/node_modules/�[4mprettier�[24m/index.mjs:19897:12�[90m)�[39m
    at importFromFile �[90m(file:///Users/tbo/�[39mgit/project/node_modules/�[4m.pnpm�[24m/[email protected]/node_modules/�[4mprettier�[24m/index.mjs:19912:15�[90m)�[39m
    at importFromDirectory �[90m(file:///Users/tbo/�[39mgit/project/node_modules/�[4m.pnpm�[24m/[email protected]/node_modules/�[4mprettier�[24m/index.mjs:20181:10�[90m)�[39m
    at �[90mfile:///Users/tbo/�[39mgit/project/node_modules/�[4m.pnpm�[24m/[email protected]/node_modules/�[4mprettier�[24m/index.mjs:20198:12
    at async loadPlugin �[90m(file:///Users/tbo/�[39mgit/project/node_modules/�[4m.pnpm�[24m/[email protected]/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.

@tbo tbo closed this as completed Sep 16, 2023
@tbo tbo reopened this Sep 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant