Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prettier pluguin doesn't work with vscode 1.79.0 - error "cannot read properties of undefined (reading 'uid')" #3019

Closed
ziimakc opened this issue Jun 8, 2023 · 14 comments · Fixed by #3030
Labels
locked Please open a new issue and fill out the template instead of commenting.

Comments

@ziimakc
Copy link

ziimakc commented Jun 8, 2023

Summary

Prettier plugin doesn't work with vscode 1.79.0 (before update it worked fine)

Steps To Reproduce:

Run format

Expected result

Document should be formatted

Actual result

Document not formatted, error shown in terminal prettier output

Additional information

Repository is monorepo

Versions:

  • prettier: 2.8.8
  • prettier vscode: 9.13.0
  • vscode: 1.79.0
  • windows 11 wsl

Prettier Log Output

Error:

["ERROR" - 12:05:24 AM] Failed to load module. If you have prettier or plugins referenced in package.json, ensure you have run `npm install`
["ERROR" - 12:05:24 AM] Cannot read properties of undefined (reading 'uid')
TypeError: Cannot read properties of undefined (reading 'uid')
	at Object.statSync (/home/ziimakc/.vscode-server/bin/b380da4ef1ee00e224a15c1d4d9793e27c2b6302/node_modules/graceful-fs/polyfills.js:313:17)
	at p (/home/ziimakc/.vscode-server/extensions/esbenp.prettier-vscode-9.13.0/dist/extension.js:1:35221)
	at L (/home/ziimakc/.vscode-server/extensions/esbenp.prettier-vscode-9.13.0/dist/extension.js:1:37052)
	at /home/ziimakc/.vscode-server/extensions/esbenp.prettier-vscode-9.13.0/dist/extension.js:1:36677
	at Function.e.exports [as sync] (/home/ziimakc/.vscode-server/extensions/esbenp.prettier-vscode-9.13.0/dist/extension.js:1:36723)
	at t.ModuleResolver.findPkg (/home/ziimakc/.vscode-server/extensions/esbenp.prettier-vscode-9.13.0/dist/extension.js:1:7297)
	at t.ModuleResolver.getPrettierInstance (/home/ziimakc/.vscode-server/extensions/esbenp.prettier-vscode-9.13.0/dist/extension.js:1:3251)
	at t.default.format (/home/ziimakc/.vscode-server/extensions/esbenp.prettier-vscode-9.13.0/dist/extension.js:1:13495)
	at async t.PrettierEditProvider.provideEdits (/home/ziimakc/.vscode-server/extensions/esbenp.prettier-vscode-9.13.0/dist/extension.js:1:11367)
	at async U.provideDocumentFormattingEdits (/home/ziimakc/.vscode-server/bin/b380da4ef1ee00e224a15c1d4d9793e27c2b6302/out/vs/workbench/api/node/extensionHostProcess.js:102:45790)
["ERROR" - 12:05:24 AM] Prettier could not be loaded. See previous logs for more information.
@ziimakc
Copy link
Author

ziimakc commented Jun 8, 2023

Related #3000

Quick fix, add to project settings in .vscode/settings.json

"prettier.prettierPath": "./node_modules/prettier"

@oncet
Copy link

oncet commented Jun 8, 2023

Having the same problem. If the project I'm working on has prettier installed as a dependency, the plugin fails an throws the same error as OP.

The fix suggested in #3019 (comment) solves the problem.

@szszoke
Copy link

szszoke commented Jun 9, 2023

Related #3000

Quick fix, add to project settings in .vscode/settings.json

"prettier.prettierPath": "./node_modules/prettier"

This does't work for me. I still get the same error.

I do have my project in a sub-directory, so I changed the path accordingly.

@ziimakc ziimakc changed the title Prettier pluguin doesn't work with vscode 1.79.0 Prettier pluguin doesn't work with vscode 1.79.0 - error "cannot read properties of undefined (reading 'uid')" Jun 9, 2023
@luchillo17
Copy link

@szszoke Make sure you're changing prettierPath not prettierConfigPath, very similar names, I made that mistake a sec ago.

@szszoke
Copy link

szszoke commented Jun 9, 2023

@szszoke Make sure you're changing prettierPath not prettierConfigPath, very similar names, I made that mistake a sec ago.

No worries! I just downgraded VS Code until this is resolved.

@alvIndieDevelop
Copy link

@szszoke Make sure you're changing prettierPath not prettierConfigPath, very similar names, I made that mistake a sec ago.

No worries! I just downgraded VS Code until this is resolved.

for me, it work, on vscode settings on workSpaces.

{ "prettier.prettierPath": "./node_modules/prettier" }

@szszoke
Copy link

szszoke commented Jun 14, 2023

@szszoke Make sure you're changing prettierPath not prettierConfigPath, very similar names, I made that mistake a sec ago.

No worries! I just downgraded VS Code until this is resolved.

for me, it work, on vscode settings on workSpaces.

{ "prettier.prettierPath": "./node_modules/prettier" }

I tested again and it still doesn't work so I downgraded VS Code again.

@xianghongai
Copy link

vs code upgrade to 1.79.1

@xylinq
Copy link

xylinq commented Jun 15, 2023

vs code upgrade to 1.79.1

still have problem,not work

@luchillo17
Copy link

Tested with a recent update, seems to be working after removing the prettierPath workaround.

@sosukesuzuki
Copy link
Member

sosukesuzuki commented Jun 16, 2023

@luchillo17 VSCode v1.79.2?

@DylanSpOddball
Copy link

FWIW, I just tested with VSCode v1.79.2, this problem still occurred when not using the workaround.

@luchillo17
Copy link

Yes v1.79.2, just restarted my WSL2 instance to make sure it still worked, which version has #3030 in?

Copy link

github-actions bot commented Nov 6, 2023

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 github-actions bot added the locked Please open a new issue and fill out the template instead of commenting. label Nov 6, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked Please open a new issue and fill out the template instead of commenting.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants