prettier / prettier-vscode

Visual Studio Code extension for Prettier
https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode
MIT License
5.04k stars 446 forks source link

Prettier- TypeError: Cannot read properties of undefined (reading 'uid') #3020

Closed sumanssaurabh closed 11 months ago

sumanssaurabh commented 11 months ago

Edited by maintainer

I'll work on this. So please do not post any more +1 comments..

https://github.com/prettier/prettier-vscode/issues/3020#issuecomment-1586703424


Type: Bug

Prettier running in ssh remote gives error vscode TypeError: Cannot read properties of undefined (reading 'uid') at Object.statSync (/home/ubuntu/.vscode-server/bin/b380da4ef1ee00e224a15c1d4d9793e27c2b6302/node_modules/graceful-fs/polyfills.js:313:17)

Extension version: 9.13.0 VS Code version: Code 1.79.0 (b380da4ef1ee00e224a15c1d4d9793e27c2b6302, 2023-06-07T14:26:35.552Z) OS version: Windows_NT x64 10.0.19045 Modes: Connection to 'ssh-remote+neo' could not be established

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz (4 x 2400)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|undefined| |Memory (System)|15.89GB (8.05GB free)| |Process Argv|| |Screen Reader|no| |VM|0%| Connection to 'ssh-remote+neo' could not be established
aleimu commented 11 months ago

+1

mupkoo commented 11 months ago

This happened to me this morning after I upgraded VS Code to 1.79.0

Clark-G commented 11 months ago

This also happended to me today, my vs code version is 1.79.0

einarpersson commented 11 months ago

Same here 1.79.0

NattakornS commented 11 months ago

Me also happened on vscode 1.79.0.

xiaojia21190 commented 11 months ago

+1

sumanssaurabh commented 11 months ago

workaround suggested in https://github.com/prettier/prettier-vscode/issues/3019#issuecomment-1583356998

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

"prettier.prettierPath": "./node_modules/prettier"
gyhyfj commented 11 months ago

same problem

szszoke commented 11 months ago

The problem started for me after I went from 1.78.2 to 1.79.0.

paul-vd commented 11 months ago

Same here

adsonmacedo commented 11 months ago

+1

AnmSaiful commented 11 months ago

I just attempted to report the issue and found this one.

+1

souvikmishra commented 11 months ago

+1 also happens when running vscode in wsl

pedroperesx commented 11 months ago

+1

And my vs code version is 1.79.0

Rigel-Developer commented 11 months ago

same problem here!!

gitawego commented 11 months ago

I've the same issue with vscode 1.79.0

trulycool commented 11 months ago

Same problem directly after upgrade VS Code. The fix suggested above by @sumanssaurabh fixed it straight away, no reload/restart required...thanks very much for that! 🙏

narcis-fv commented 11 months ago

+1

MikeFranco commented 11 months ago

Solved with @sumanssaurabh fix, thanks man ❤️

jngchenghin-msft commented 11 months ago

+1 that it started happening when I upgraded my VSCode, but @sumanssaurabh 's fix worked perfectly for me too.

kayandra commented 11 months ago

+1 here.... I was going crazy thinking I'd somehow broken my vscode installation.

JoarDev commented 11 months ago

+1 first time trying the prettier extension and this happened :(

oezguerisbert commented 11 months ago

Here is a small quickfix. Create a file in the root of the project; .vscode/settings.json

{
  ...
  "prettier.prettierPath": "./node_modules/prettier"
}
victor-pagnozi commented 11 months ago

workaround suggested in #3019 (comment)

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

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

Solved with your fix, man!! Tksss

709kyb commented 11 months ago

@sumanssaurabh it works ! thanks man.

dantevicenzo commented 11 months ago

workaround suggested in #3019 (comment)

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

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

This solved here. Thanks!

jeremydthomas commented 11 months ago

workaround suggested in #3019 (comment)

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

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

thank you so much, fixed it!

immois commented 11 months ago

It also works by adding it to the VSCode configuration like this:

Looking for Prettier Path and adding ./node_modules/prettier image

jtapeg commented 11 months ago

The correction must be made by vscode, the problem is in the extension installation

This solution doesn't work well if the file is not together with node_modules image

lucasbazev commented 11 months ago

workaround suggested in #3019 (comment)

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

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

this worked like a charm! thanks a lot

parkgang commented 11 months ago

+1

sosukesuzuki commented 11 months ago

I'll work on this. So please do not post any more +1 comments..

sosukesuzuki commented 11 months ago

Has anyone had this happen in an environment other than ssh? I could not reproduce this on my local machine (MacOS).

parkgang commented 11 months ago

Has anyone had this happen in an environment other than ssh? I could not reproduce this on my local machine (MacOS).

I had that problem in my local WSL2 environment.

sosukesuzuki commented 11 months ago

Thanks, but I think WSL's VSCode uses ssh internally. Right?

parkgang commented 11 months ago

Thanks, but I think WSL's VSCode uses ssh internally. Right?

I'm not sure if you use SSH . However, it is inferred from VSCode's connection to work remotely.

edx-mohammed-waleed commented 11 months ago

./node_modules/prettier

This fixed it, thanks

xiaoqiang1999 commented 11 months ago

+1

gitchaell commented 11 months ago

I have managed to solve it in the following way:

  1. Install Prettier as a global dependency
npm install -g prettier
  1. Obtain the installation path of global npm dependencies (/home/user/.nvm/versions/node/v12.16.1/lib/node_modules/ in my case)
npm root -g
  1. Navigate to VSCode Prettier Path configuration section and paste the path + /prettier)

image

kayandra commented 11 months ago

I have managed to solve it in the following way:

1. Install Prettier as a global dependency
npm install -g prettier
2. Obtain the installation path of global npm dependencies (`/home/user/.nvm/versions/node/v12.16.1/lib/node_modules/` in my case)
npm root -g
3. Navigate to VSCode Prettier Path configuration section and paste the path + ` /prettier`)

image

I did the same thing, but didn't comment it as a solution as it's hacky and not documented.

jtapeg commented 11 months ago

Alguém já viu isso acontecer em um ambiente diferente do ssh? Não consegui reproduzir isso na minha máquina local (MacOS).

Just install Debian or Ubuntu on Windows WSL and try to use prettier with the latest version of VSCODE

basicdays commented 11 months ago

I'm also having this happen when using Docker and remote Dev Containers. Host machine is MacOS.

anrondon-microsoft commented 11 months ago

+1 Having the same problem with WSL Ubuntu on a Windows host

ffimnsr commented 11 months ago

Same problem the said temporary fix above doesn't work with npm/pnpm workspace installed prettier.

josephinebienes commented 11 months ago

workaround suggested in #3019 (comment)

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

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

Had the same problem with WSL Ubuntu in Windows and the above worked for me

jooyal commented 11 months ago

workaround suggested in #3019 (comment)

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

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

Thanks! This fixed the issue for me.

hrenaud commented 11 months ago

Inside a devcontainer:

  1. do npm install -g prettier
  2. do nvm install XX.xx.yy ← change XX.xx.yy to the node version to needed
  3. in VSCode settings or in .devcontainer/devcontainer.json set
    "prettier.prettierPath": "$NVM_DIR/current/lib/node_modules"
viceice commented 11 months ago

Duplicate of #3019

coderdix24 commented 11 months ago

same problem

lol why you get down-voted hahahhaa ... anyways happened to me as well, going to try one of these fixes

devferx commented 11 months ago

Same problem here