prettier-vscode: Broken in vs code insiders
Summary
Prettier/extension is not loaded
Steps To Reproduce:
- Start VS Code
Actual result
Prettier doesn’t work
VS Code Version:
Version: 1.79.0-insider (user setup) Commit: f5d658848a7d39546e48b9393690b5ff18473a7b Date: 2023-05-04T05:21:45.650Z Electron: 22.4.8 Chromium: 108.0.5359.215 Node.js: 16.17.1 V8: 10.8.168.25-electron.0 OS: Windows_NT x64 10.0.22621 Sandboxed: Yes
Prettier Extension Version: 9.12.0
OS and version: ubuntu 22.04 wsl2 on win 11
Prettier Log Output
["INFO" - 5:52:19 PM] Extension Name: esbenp.prettier-vscode.
["INFO" - 5:52:19 PM] Extension Version: 9.12.0.
["INFO" - 5:52:19 PM] Attempted to determine module path from package.json
["ERROR" - 5:52:19 PM] Failed to load module. If you have prettier or plugins referenced in package.json, ensure you have run `npm install`
["ERROR" - 5:52:19 PM] Cannot read properties of undefined (reading 'uid')
TypeError: Cannot read properties of undefined (reading 'uid')
at Object.statSync (/home/eldair/.vscode-server-insiders/bin/f5d658848a7d39546e48b9393690b5ff18473a7b/node_modules/graceful-fs/polyfills.js:313:17)
at p (/home/eldair/.vscode-server-insiders/extensions/esbenp.prettier-vscode-9.12.0/dist/extension.js:1:35702)
at b (/home/eldair/.vscode-server-insiders/extensions/esbenp.prettier-vscode-9.12.0/dist/extension.js:1:37533)
at /home/eldair/.vscode-server-insiders/extensions/esbenp.prettier-vscode-9.12.0/dist/extension.js:1:37158
at Function.e.exports [as sync] (/home/eldair/.vscode-server-insiders/extensions/esbenp.prettier-vscode-9.12.0/dist/extension.js:1:37204)
at t.ModuleResolver.findPkg (/home/eldair/.vscode-server-insiders/extensions/esbenp.prettier-vscode-9.12.0/dist/extension.js:1:7297)
at t.ModuleResolver.getPrettierInstance (/home/eldair/.vscode-server-insiders/extensions/esbenp.prettier-vscode-9.12.0/dist/extension.js:1:3251)
at t.default.handleActiveTextEditorChanged (/home/eldair/.vscode-server-insiders/extensions/esbenp.prettier-vscode-9.12.0/dist/extension.js:1:9781)
at t.default.handleActiveTextEditorChangedSync (/home/eldair/.vscode-server-insiders/extensions/esbenp.prettier-vscode-9.12.0/dist/extension.js:1:9383)
at t.default.registerDisposables (/home/eldair/.vscode-server-insiders/extensions/esbenp.prettier-vscode-9.12.0/dist/extension.js:1:12226)
at /home/eldair/.vscode-server-insiders/extensions/esbenp.prettier-vscode-9.12.0/dist/extension.js:1:77800
at processTicksAndRejections (node:internal/process/task_queues:96:5)
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 59
- Comments: 19 (1 by maintainers)
Commits related to this issue
- fix: add workaround for https://github.com/prettier/prettier-vscode/issues/3000 — committed to otohime-site/web by littlebtc a year ago
- chore(prettier): fix prettier extension "Cannot read properties of undefined (reading 'uid')" Seems like the latest version of VSCode broke prettier. See: * https://github.com/microsoft/vscode/issue... — committed to dansdata-se/api by FelixZY a year ago
Well, not sure if it is the correct way to resolve but,
After changing the prettier path settings to the ones below, it does the trick.
"prettier.prettierPath": "./node_modules/prettier"
Thank you!
It’s nice that there is a workaround, but I was hoping this issue would be fixed. I switched from Insiders to the standard VSCode release when this started happening, and now the standard VSCode has just started to have the same error.
Now I’ll have to apply the workaround, and every indication here makes me think it will work fine. But I think it’s important to note that this is still an error that should be fixed.
In my case, it seems like a problem with
resolver
. The extension is not working only in Monorepo.dist/extensions.js:1:37517
From:
To:
THank you @Dnouv this saved my day
thank you @Dnouv , this helped me as well:
Can confirm that just dropping the path here has solved the issue for now, was getting the same error:
+1 thanks @Dnouv, your solution worked for me. Previously I had no issues in the non-Insiders VSCode in the same codebase.
To add keywords for those searching this out: I’m sure a lot of people are trying Insiders because of the GitHub Copilot Chat and wondering why prettier is broken.
In case it helps those troubleshooting I’ll add how to see Prettier log output:
You’ll see any error or success output here when you try to format a file with prettier.
Duplicate of https://github.com/prettier/prettier-vscode/issues/3020
Seems still to be broken in nromal VS Code
@Dnouv you’re amazing. Thank you!
@Dnouv i have some issues and your helpful solution worked for me! Thanks
@Dnouv - thanks - spent an hour trying to solve this and your suggestion worked!