stevearc / conform.nvim

Lightweight yet powerful formatter plugin for Neovim
MIT License
2.87k stars 149 forks source link

Conform.nvim Cannot find module '@vercel/style-guide/prettier' #487

Open hakkm opened 2 months ago

hakkm commented 2 months ago

I'm working on a nextjs project where I've a prettier.config.js config file, prettier.config.js:

const styleguide = require('@vercel/style-guide/prettier');

module.exports = {
  ...styleguide,
  plugins: [...styleguide.plugins, 'prettier-plugin-tailwindcss'],
};

when i try to format it i got the following error

:ConformInfo

18:07:23[ERROR] Formatter 'prettier' error: [error] Invalid configuration for file "/home/me/projects/nextjs-dashboard/app/lib/actions.ts":
[error] Cannot find module '@vercel/style-guide/prettier'
[error] Require stack:
[error] - /home/me/projects/nextjs-dashboard/prettier.config.js

Even when i pnpm install --save-dev prettier, it do not work. Appreciate any help.

saifullah1088 commented 2 months ago

I am also facing the same issue my code is not formatted.

hakkm commented 2 months ago

I am also facing the same issue my code is not formatted.

just comment lines added by vercel, if you just want it to work without vercel stuff

stevearc commented 1 month ago

Please follow the bug report template. It will guide you towards setting the log level to be more verbose so we can see exactly what command is being run.

The thing to do in these situations is to check what command conform is running, and see if that works when you run that directly on the command line. Usually this surfaces a problem either with the formatter, the environment, or how conform is configured to run the formatter.