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

Uncaught TypeError: Cannot read property 'version' of undefined

Open kaiyoma opened this issue 5 years ago • 7 comments

If I try to view prettier debug info inside Atom, I get this:

...\.atom\packages\prettier-atom\dist\displayDebugInfo\index.js:27
Hide Stack Trace
TypeError: Cannot read property 'version' of undefined
    at getDebugInfo (...\.atom\packages\prettier-atom\dist\displayDebugInfo\index.js:27:51)
    at HTMLElement.displayDebugInfo (...\.atom\packages\prettier-atom\dist\displayDebugInfo\index.js:36:11)
    at CommandRegistry.handleCommandEvent (...\AppData\Local\atom\app-1.47.0\resources\app\static\<embedded>:11:349576)
    at Object.didConfirmSelection (...\AppData\Local\atom\app-1.47.0\resources\app\static\<embedded>:11:694812)
    at SelectListView.confirmSelection (...\AppData\Local\atom\app-1.47.0\resources\app\static\<embedded>:11:866372)
    at HTMLDivElement.core:confirm (...\AppData\Local\atom\app-1.47.0\resources\app\static\<embedded>:11:861251)
    at CommandRegistry.handleCommandEvent (...\AppData\Local\atom\app-1.47.0\resources\app\static\<embedded>:11:349576)
    at KeymapManager.dispatchCommandEvent (...\AppData\Local\atom\app-1.47.0\resources\app\static\<embedded>:11:1242036)
    at KeymapManager.handleKeyboardEvent (...\AppData\Local\atom\app-1.47.0\resources\app\static\<embedded>:11:1238170)
    at WindowEventHandler.handleDocumentKeyEvent (...\AppData\Local\atom\app-1.47.0\resources\app\static\<embedded>:11:284782)

Versions:

OS: Windows 10 Atom: 1.47.0 prettier-atom: 0.60.0 prettier: 2.0.5

kaiyoma avatar May 20 '20 15:05 kaiyoma

I've been seeing for weeks myself (but on macOS), renders the package unusable.

robbymarston avatar May 20 '20 15:05 robbymarston

same here. Atom[Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.47.0 x64 Electron: 5.0.13 OS: Mac OS X 10.15.4 Thrown From: prettier-atom package 0.60.0

Stack Trace

Uncaught TypeError: Cannot read property 'version' of undefined

At /Users/dev.local/.atom/packages/prettier-atom/dist/displayDebugInfo/index.js:27

TypeError: Cannot read property 'version' of undefined
    at getDebugInfo (/packages/prettier-atom/dist/displayDebugInfo/index.js:27:51)
    at HTMLElement.displayDebugInfo (/packages/prettier-atom/dist/displayDebugInfo/index.js:36:11)
    at CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:349576)
    at Object.didConfirmSelection (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:694812)
    at SelectListView.confirmSelection (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:866372)
    at HTMLDivElement.core:confirm (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:861251)
    at CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:349576)
    at KeymapManager.dispatchCommandEvent (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:1242036)
    at KeymapManager.handleKeyboardEvent (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:1238170)
    at WindowEventHandler.handleDocumentKeyEvent (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:284782)

Commands

     -0:32.6.0 core:move-up (input.hidden-input)
     -0:31.4.0 snippets:next-tab-stop (input.hidden-input)
     -0:31.4.0 snippets:expand (input.hidden-input)
     -0:31.4.0 editor:indent (input.hidden-input)
     -0:29.8.0 core:backspace (input.hidden-input)
 19x -0:26.7.0 core:undo (input.hidden-input)
     -0:19.5.0 core:cut (input.hidden-input)
     -0:16.8.0 core:backspace (input.hidden-input)
     -0:16.6.0 core:paste (input.hidden-input)
  2x -0:14.4.0 editor:newline (input.hidden-input)
     -0:11.5.0 core:save (input.hidden-input)
     -0:10 command-palette:toggle (input.hidden-input)
     -0:09.1.0 core:confirm (input.hidden-input)
     -0:09.1.0 prettier:debug (input.hidden-input)
     -0:08.3.0 core:move-down (input.hidden-input)
     -0:08.3.0 editor:newline (input.hidden-input)

Non-Core Packages

atom-material-muted-syntax 1.0.10 
atom-material-numix-syntax 0.2.1 
atom-material-syntax-dark 1.0.0 
atom-material-ui 2.1.3 
autocomplete-javascript 0.0.2 
autocomplete-modules 2.3.0 
base64 0.8.0 
busy-signal 2.0.1 
fast-eslint 4.13.0 
gulp-control 0.5.0 
intentions 1.1.5 
linter 2.3.1 
linter-ui-default 1.8.1 
material 2.2.0 
platformio-ide-terminal 2.10.0 
prettier-atom 0.60.0 
pretty-json 2.1.2 
react 0.18.0 
react-snippets 1.2.0 
touchbar-registry 0.3.2 
touchbar-run 0.1.1 
xml-formatter 0.13.0 

sourdenis avatar May 22 '20 10:05 sourdenis

I see the same output when running the Prettier: Debug command.

I'm also on prettier-atom 0.60.0 although my prettier is 2.0.2.

My issue is the Format on Save won't work, but the Prettier: Format does work.

If I turn off both Only format if Prettier is found in your project's dependencies and Only format if a Prettier config is found, then Format on Save works again. If I turn either option on, Format on Save stops working.

I'm guessing there's an issue reading the prettier.config.js and an issue reading the package.json.

RodFashion avatar May 23 '20 12:05 RodFashion

@RodFashion prettier had a regression in their codebase, that's a known bad version on their part (they made prettier incompatible with the version of node that Atom uses lol), I would update to latest to get format on save working again.

robwise avatar Jun 03 '20 18:06 robwise

Will have to look into the debug thing although @robbymarston you should be able to use the plugin overall, it's just the debug that's in question here right all?

robwise avatar Jun 03 '20 18:06 robwise

@robwise apologies for the delay. Similar to @RodFashion's comment above, Format on Save does not work, but Prettier: Format does.

robbymarston avatar Jun 04 '20 14:06 robbymarston

@robbymarston Can you confirm you're on latest Prettier version? They regressed their codebase to be incompatible with the verison of Node that Atom uses in a couple of the previous versions but that is now fixed.

robwise avatar Jun 05 '20 01:06 robwise