prettier-vscode icon indicating copy to clipboard operation
prettier-vscode copied to clipboard

Prettier refusing to work - `npm.PackageManager` issue

Open transcental opened this issue 2 years ago • 2 comments

Summary

I have a GH Codespace with Prettier installed. In my JSX, Prettier is not formatting the code. If I go to Output > Prettier, it says ["INFO" - 5:30:41 PM] Formatting file:///workspaces/react-chat-app/client/src/components/TeamChannelPreview.jsx but it never actually formats it.

If I run Format Document With > Prettier from the Command Palette, I get this error: Command 'Format Document With...' resulted in an error (command 'npm.packageManager' not found)

I've used Prettier for months and this has never happened before.

I did a little extra testing and noticed that it isn't specific to the .jsx file. It didn't work on a .html file either. It also didn't work in a local environment. I haven't changed any settings recently, so I don't know why it stopped working.

Github Repository to Reproduce Issue

N/A. This can be reproduced with any JSX file I found.

Steps To Reproduce:

  1. Create a React JSX file
  2. Try and format it with prettier. I have format on save enabled.

Expected result

I expected the file that had blatant formatting issues to be formatted

Actual result

Nothing. It said it was formatting and nothing happened.

Additional information

VS Code Version:

Version: 1.68.0 Commit: 4af164ea3a06f701fe3e89a2bcbb421d2026b68f Date: 2022-06-08T11:44:00.250Z Electron: 17.4.7 Chromium: 98.0.4758.141 Node.js: 16.13.0 V8: 9.8.177.13-electron.0 OS: Darwin x64 19.6.0

Prettier Extension Version: v9.5.0

OS and version: macOS Catalina 10.15.7

Prettier Log Output

N/A When turning on debug logs, no extra information is printed. However, I went into the Extension Host and it says this:

[2022-06-13 17:51:15.586] [exthost] [error] [esbenp.prettier-vscode] provider FAILED
[2022-06-13 17:51:15.586] [exthost] [error] Error: command 'npm.packageManager' not found
    at v._tryExecuteCommand (vscode-file://vscode-app/Users/dillonbarnes/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:1706:3532)
    at v.executeCommand (vscode-file://vscode-app/Users/dillonbarnes/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:1706:3414)

I believe that this is an issue with a recent update of Prettier as I haven't changed my setup for a while and Prettier only just stopped working a few days ago.

transcental avatar Jun 13 '22 17:06 transcental

This issue is still occurring and seems to be random... (Well, I know it's not but I can't spot any reasons for it)

transcental avatar Jul 13 '22 18:07 transcental

This bug is missing information needed to diagnose the problem. Please see our guide on how to open a good issue and provide the missing information.

github-actions[bot] avatar Aug 20 '22 19:08 github-actions[bot]

This issue has been labeled as stale due to inactivity. Reply to keep this issue open.

github-actions[bot] avatar Apr 22 '23 14:04 github-actions[bot]

Apologies, forgot about this as it never happened again. Will close for now as it may be a fixed bug.

transcental avatar Apr 22 '23 14:04 transcental

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

github-actions[bot] avatar Jul 22 '23 00:07 github-actions[bot]