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

9.12.0 not detecting the local project (node_modules) prettier #3002

Closed
sneridagh opened this issue May 10, 2023 · 6 comments
Closed

9.12.0 not detecting the local project (node_modules) prettier #3002

sneridagh opened this issue May 10, 2023 · 6 comments
Labels
locked Please open a new issue and fill out the template instead of commenting.

Comments

@sneridagh
Copy link

sneridagh commented May 10, 2023

Summary

Once I updated to 9.12.0 it seems that the plugin does not detect the project node_modules prettier version.

I managed to fix it when you set:

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

It works again, that's why my guess is that something is wrong with the local prettier detection.
Another hint, going back to 9.10.4 makes it work again, so something is wrong in the last versions.

A last one, running the prettier command line still works well.

Github Repository to Reproduce Issue

I think it's pretty obvious, no need for example repo

Steps To Reproduce:

  1. Upgrade prettier vscode plugin to latest
  2. If you try to run prettier through the plugin your code is messed up (problably is getting the prettier in the plugin itself)

Expected result

It detects the local project

Actual result

All my files get unprettied :) when you run prettier using the plugin

Additional information

Feel free to attach a screenshot.

VS Code Version:

Version: 1.78.0 (April)

Prettier Extension Version:

9.12.0

OS and version:

MacOS Ventura

Prettier Log Output

["INFO" - 18:15:17] Detected local configuration (i.e. .prettierrc or .editorconfig), VS Code configuration will not be used
["INFO" - 18:15:17] Prettier Options:
{
  "filepath": "/Users/sneridagh/Development/plone/volto/src/helpers/index.js",
  "parser": "babel",
  "useTabs": false,
  "tabWidth": 2,
  "endOfLine": "lf",
  "trailingComma": "all",
  "singleQuote": true
}
["INFO" - 18:15:17] Formatting completed in 16ms.
@paul-vd
Copy link

paul-vd commented May 11, 2023

Same issue here, thanks for the fix, this is only happening to me on the vscode 1.79.0-insiders build, on 1.78.1 it's working fine.

here is my log output:

["INFO" - 12:36:41 PM] Attempted to determine module path from package.json
["ERROR" - 12:36:41 PM] Failed to load module. If you have prettier or plugins referenced in package.json, ensure you have run `npm install`
["ERROR" - 12:36:41 PM] Cannot read properties of undefined (reading 'uid')
TypeError: Cannot read properties of undefined (reading 'uid')
 at Object.statSync (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/node_modules/graceful-fs/polyfills.js:313:17)
    at p (/home/paul/.vscode-server-insiders/extensions/esbenp.prettier-vscode-9.12.0/dist/extension.js:1:35702)
    at b (/home/paul/.vscode-server-insiders/extensions/esbenp.prettier-vscode-9.12.0/dist/extension.js:1:37533)
    at /home/paul/.vscode-server-insiders/extensions/esbenp.prettier-vscode-9.12.0/dist/extension.js:1:37158
    at Function.e.exports [as sync] (/home/paul/.vscode-server-insiders/extensions/esbenp.prettier-vscode-9.12.0/dist/extension.js:1:37204)
    at t.ModuleResolver.findPkg (/home/paul/.vscode-server-insiders/extensions/esbenp.prettier-vscode-9.12.0/dist/extension.js:1:7297)
    at t.ModuleResolver.getPrettierInstance (/home/paul/.vscode-server-insiders/extensions/esbenp.prettier-vscode-9.12.0/dist/extension.js:1:3251)
    at t.default.handleActiveTextEditorChanged (/home/paul/.vscode-server-insiders/extensions/esbenp.prettier-vscode-9.12.0/dist/extension.js:1:9781)
    at handleActiveTextEditorChangedSync (/home/paul/.vscode-server-insiders/extensions/esbenp.prettier-vscode-9.12.0/dist/extension.js:1:9383)
    at w.invoke (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:63:145)
    at u.deliver (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:63:2121)
    at i.fire (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:63:1729)
    at /home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:104:16109
    at w.invoke (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:63:145)
    at u.deliver (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:63:2121)
    at i.fire (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:63:1729)
    at e.ExtHostDocumentsAndEditors.acceptDocumentsAndEditorsDelta (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:102:14003)
    at e.ExtHostDocumentsAndEditors.$acceptDocumentsAndEditorsDelta (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:102:12318)
    at o.N (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:112:11620)
    at o.M (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:112:11338)
    at o.H (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:112:10431)
    at o.G (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:112:9412)
    at /home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:112:8200
    at w.invoke (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:63:145)
    at u.deliver (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:63:2121)
    at i.fire (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:63:1729)
    at b.fire (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:73:14851)
    at /home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:128:32461
    at w.invoke (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:63:145)
    at u.deliver (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:63:2121)
    at i.fire (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:63:1729)
    at b.fire (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:73:14851)
    at d.E (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:73:18898)
    at /home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:73:16886
    at w.invoke (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:63:145)
    at u.deliver (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:63:2121)
    at i.fire (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:63:1729)
    at h.acceptChunk (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:73:12582)
    at /home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:73:11869
    at w.invoke (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:63:145)
    at u.deliver (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:63:2121)
    at i.fire (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:63:1729)
    at y.u (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:128:20037)
    at y.acceptFrame (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:128:19843)
    at u.l (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:128:18436)
    at /home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:128:15773
    at Socket.r (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:128:13607)
    at Socket.emit (node:events:513:28)
    at addChunk (node:internal/streams/readable:315:12)
    at readableAddChunk (node:internal/streams/readable:289:9)
    at Socket.Readable.push (node:internal/streams/readable:228:10)
    at TCP.onStreamRead (node:internal/stream_base_commons:190:23)

@sneridagh
Copy link
Author

@paul-vd for me it does not break, it just not getting the right prettier version (or not at all).

@chenjiayi8
Copy link

Same issue here, thanks for the fix, this is only happening to me on the vscode 1.79.0-insiders build, on 1.78.1 it's working fine.

here is my log output:

["INFO" - 12:36:41 PM] Attempted to determine module path from package.json
["ERROR" - 12:36:41 PM] Failed to load module. If you have prettier or plugins referenced in package.json, ensure you have run `npm install`
["ERROR" - 12:36:41 PM] Cannot read properties of undefined (reading 'uid')
TypeError: Cannot read properties of undefined (reading 'uid')
 at Object.statSync (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/node_modules/graceful-fs/polyfills.js:313:17)
    at p (/home/paul/.vscode-server-insiders/extensions/esbenp.prettier-vscode-9.12.0/dist/extension.js:1:35702)
    at b (/home/paul/.vscode-server-insiders/extensions/esbenp.prettier-vscode-9.12.0/dist/extension.js:1:37533)
    at /home/paul/.vscode-server-insiders/extensions/esbenp.prettier-vscode-9.12.0/dist/extension.js:1:37158
    at Function.e.exports [as sync] (/home/paul/.vscode-server-insiders/extensions/esbenp.prettier-vscode-9.12.0/dist/extension.js:1:37204)
    at t.ModuleResolver.findPkg (/home/paul/.vscode-server-insiders/extensions/esbenp.prettier-vscode-9.12.0/dist/extension.js:1:7297)
    at t.ModuleResolver.getPrettierInstance (/home/paul/.vscode-server-insiders/extensions/esbenp.prettier-vscode-9.12.0/dist/extension.js:1:3251)
    at t.default.handleActiveTextEditorChanged (/home/paul/.vscode-server-insiders/extensions/esbenp.prettier-vscode-9.12.0/dist/extension.js:1:9781)
    at handleActiveTextEditorChangedSync (/home/paul/.vscode-server-insiders/extensions/esbenp.prettier-vscode-9.12.0/dist/extension.js:1:9383)
    at w.invoke (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:63:145)
    at u.deliver (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:63:2121)
    at i.fire (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:63:1729)
    at /home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:104:16109
    at w.invoke (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:63:145)
    at u.deliver (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:63:2121)
    at i.fire (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:63:1729)
    at e.ExtHostDocumentsAndEditors.acceptDocumentsAndEditorsDelta (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:102:14003)
    at e.ExtHostDocumentsAndEditors.$acceptDocumentsAndEditorsDelta (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:102:12318)
    at o.N (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:112:11620)
    at o.M (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:112:11338)
    at o.H (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:112:10431)
    at o.G (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:112:9412)
    at /home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:112:8200
    at w.invoke (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:63:145)
    at u.deliver (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:63:2121)
    at i.fire (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:63:1729)
    at b.fire (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:73:14851)
    at /home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:128:32461
    at w.invoke (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:63:145)
    at u.deliver (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:63:2121)
    at i.fire (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:63:1729)
    at b.fire (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:73:14851)
    at d.E (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:73:18898)
    at /home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:73:16886
    at w.invoke (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:63:145)
    at u.deliver (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:63:2121)
    at i.fire (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:63:1729)
    at h.acceptChunk (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:73:12582)
    at /home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:73:11869
    at w.invoke (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:63:145)
    at u.deliver (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:63:2121)
    at i.fire (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:63:1729)
    at y.u (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:128:20037)
    at y.acceptFrame (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:128:19843)
    at u.l (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:128:18436)
    at /home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:128:15773
    at Socket.r (/home/paul/.vscode-server-insiders/bin/02298ef4180f2a5db39e0cb6288382860b96a596/out/vs/workbench/api/node/extensionHostProcess.js:128:13607)
    at Socket.emit (node:events:513:28)
    at addChunk (node:internal/streams/readable:315:12)
    at readableAddChunk (node:internal/streams/readable:289:9)
    at Socket.Readable.push (node:internal/streams/readable:228:10)
    at TCP.onStreamRead (node:internal/stream_base_commons:190:23)

I have the same problem with vscode 1.79.0-insider. The Prettier extension can be be loaded.

["INFO" - 10:47:04 AM] Extension Name: esbenp.prettier-vscode.
["INFO" - 10:47:04 AM] Extension Version: 9.12.0.
["INFO" - 10:47:04 AM] Attempted to determine module path from package.json
["ERROR" - 10:47:04 AM] Failed to load module. If you have prettier or plugins referenced in package.json, ensure you have run `npm install`
["ERROR" - 10:47:04 AM] Cannot read properties of undefined (reading 'uid')
TypeError: Cannot read properties of undefined (reading 'uid')

@vitale232
Copy link

I just experienced a very similar issue.

I use VS Code on WSL. The VS Code 1.79.0 update just rolled out on my system, and with it, I started to run into the Failed to load module. message from the esbenp.prettier-vscode extension.

The workaround in the original report got me going again...

@ntotten
Copy link
Member

ntotten commented Jun 19, 2023

Duplicate of #3020

@ntotten ntotten marked this as a duplicate of #3020 Jun 19, 2023
@ntotten ntotten closed this as completed Jun 19, 2023
@github-actions
Copy link

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 Sep 18, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 18, 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

No branches or pull requests

5 participants