Quick fix: Invalid prettier configuration file detected

––– views

0 min read

I am writing this after spending an hour trying to fix Prettier. The errors I got are the ones below

Invalid prettier configuration file detected. Error: ENOENT: no such file or directory, open '/.prettierrc'

If you don’t already have the .prettierrc file in the root folder of your project, add it and see if it works for you, otherwise, follow the steps below.

Here’s the solution

  • Open VsCode settings, and search for prettier
  • Open the workspace tab and find the Prettier: Config Path setting
  • Remove the / before the file and make sure the name matches
  • That did it for me, hope it helps.

    Here’s an example .prettierrc

    JSON

    {
    ".singleQuote": true,
    "tabWidth": 2,
    }

    To comment please authenticate