conform.nvim icon indicating copy to clipboard operation
conform.nvim copied to clipboard

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

Open hakkm opened this issue 1 year ago • 3 comments

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.

hakkm avatar Jul 04 '24 17:07 hakkm

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

saifullah1088 avatar Jul 05 '24 00:07 saifullah1088

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

hakkm avatar Jul 05 '24 00:07 hakkm

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.

stevearc avatar Jul 16 '24 07:07 stevearc

@hakkm, @saifullah1088

While debugging I found this issue and I thought I'd try and explain the issue you have here. It's not related to conform.nvim at all. What is happening is that you want to use a custom styleguide plugin for Prettier called @vercel/style-guide (which has since been archived). That plugin adds custom formatting options/overrides to your Prettier config. See https://prettier.io/docs/plugins for more info.


@stevearc Initially I thought this might have something to do with the use of PNPM but that doesn't appear to be the case. I just migrated a project from NPM to PNPM and conform handles that without any issues. Think you can close this one.

99linesofcode avatar Mar 27 '25 22:03 99linesofcode