1

My prettier extension in VSCode quit working. Earlier today it was working without any issues. I am getting an error that reads:

prettier cannot format "pageName.js"

I am currently using the recently released version of prettier (v8.0). I tried re-configuring the formatter, as well as reinstalling it, however; all of my attempts to solve the issue failed. Does anyone know what is going on with prettier, could their be a problem with the latest update? Is anyone else experiencing this problem?

JΛYDΞV
  • 8,532
  • 3
  • 51
  • 77
Xaarth
  • 1,021
  • 3
  • 12
  • 34
  • You need to give us somthing more to go on bud. Try creating a test file, and use it to format a single line of code. If that works great. Keep adding lines from your file until it gives you an error message. Then you will know what its not formatting. At that point you can come back and ask us why prettier isn't formatting that line, but when you get that far you might be able to solve it yourself. – JΛYDΞV Jun 22 '21 at 16:04
  • How are you using prettier? Using some extension or using its node package or with your linter? By default Next.js does not provide anything to format code. If you are using the extension then check out Output > Prettier. If you are getting error using the package, then there should be more to that error, probably some config issue or syntax error in the file. – brc-dd Jun 22 '21 at 16:48
  • I am using prettier extension and it's formatting other js files and next js 10 as well. but not next js 10 – Xaarth Jun 22 '21 at 16:52
  • This should answer your question: https://stackoverflow.com/questions/68086012/extension-prettier-code-formatter-cannot-format-mac-v8-0 – Beatso Sep 07 '21 at 17:59

1 Answers1

2

I decided to try and recreate the issue you that you were experiencing. I didn't have to do much, as I immediately noticed I was also experiencing the same issue.

EDIT:

At this point I can confirm that they had issues with sem-var & major-ver numbering they used. All of the major-version v7.x.x doesn't appear to work, they bumped to v8.0, but that didn't work either. I can confirm that 8.1 is the working version. Before this edit v6.4 was the version that solved the issue, but now you should be good with anything v8.1.0 and up.

END EDIT

I used v6.4 initially, it worked, so I stuck with that until v8.1 released. After v8.1 prettier seems to be working fine. It looks as though they are experiencing some problems because the extension explorer is showing a release of Version 7 & Version 8 an hour ago.

You can see the version releases here:

enter image description here

To fix the issue:

  1. Open op the extension view from your activity bar.
  2. Search for prettier, Click on the standard Prettier Extension (should have 13m Downloads)
  3. Up top, next to the UNINSTALL BUTTON is an ARROW click the arrow to open up the different versions you are able to install.
  4. Hit version 8.2.0 or newer or 6.4.0 or older
  5. After it downloads completely restart your editor.

enter image description here

Now Prettier should work as expected.

JΛYDΞV
  • 8,532
  • 3
  • 51
  • 77