Skip to content

Prettier throws error about invalid version - log is a very unhelpful Invalid Version: [object Object] #3585

Open
@bnm12

Description

@bnm12

Summary

I have prettier installed in VS Code extension version is 11
I have prettier installed via NPM version is 1.19.1
When I navigate around in my files the extension throws an error, and formatting is inconsistent, sometimes it follows the repo configuration file, other times it uses its own defaults.

I found this issue #3436 and have downgraded the ESLint extension to 2.4.4 but that didn't fix my issue

Steps To Reproduce:

  1. Have prettier installed
  2. Focus a file in the editor

Expected result

I'd expect the extension to work as intended and do its job

Actual result

I got the following error

["ERROR" - 10:29:52 AM] Error handling text editor change
["ERROR" - 10:29:52 AM] Invalid Version: [object Object]
TypeError: Invalid Version: [object Object]
	at new SemVer (c:\xxx\node_modules\prettier\index.js:2462:13)
	at compare (c:\xxx\node_modules\prettier\index.js:2819:12)
	at Function.gte (c:\xxx\node_modules\prettier\index.js:2885:12)
	at filterSince (c:\xxx\node_modules\prettier\index.js:4322:82)
	at Array.filter (<anonymous>)
	at getSupportInfo (c:\xxx\node_modules\prettier\index.js:4255:6)
	at Object.getSupportInfo (c:\xxx\node_modules\prettier\index.js:44208:15)
	at t.PrettierMainThreadInstance.getSupportInfo (c:\Users\xxx\.vscode\extensions\esbenp.prettier-vscode-11.0.0\dist\extension.js:1:18548)
	at t.default.getSelectors (c:\Users\xxx\.vscode\extensions\esbenp.prettier-vscode-11.0.0\dist\extension.js:1:12074)
	at t.default.handleActiveTextEditorChanged (c:\Users\xxx\.vscode\extensions\esbenp.prettier-vscode-11.0.0\dist\extension.js:1:11123)

Additional information

N/A

VS Code Version:

Version: 1.95.2 (user setup)
Commit: e8653663e8840adaf45af01eab5c627a5af81807
Date: 2024-11-07T11:07:22.054Z
Electron: 32.2.1
ElectronBuildId: 10427718
Chromium: 128.0.6613.186
Node.js: 20.18.0
V8: 12.8.374.38-electron.0
OS: Windows_NT x64 10.0.22631

Prettier Extension Version:

11

OS and version:

Windows 11

Prettier Log Output

["ERROR" - 10:29:52 AM] Error handling text editor change
["ERROR" - 10:29:52 AM] Invalid Version: [object Object]
TypeError: Invalid Version: [object Object]
	at new SemVer (c:\xxx\node_modules\prettier\index.js:2462:13)
	at compare (c:\xxx\node_modules\prettier\index.js:2819:12)
	at Function.gte (c:\xxx\node_modules\prettier\index.js:2885:12)
	at filterSince (c:\xxx\node_modules\prettier\index.js:4322:82)
	at Array.filter (<anonymous>)
	at getSupportInfo (c:\xxx\node_modules\prettier\index.js:4255:6)
	at Object.getSupportInfo (c:\xxx\node_modules\prettier\index.js:44208:15)
	at t.PrettierMainThreadInstance.getSupportInfo (c:\Users\xxx\.vscode\extensions\esbenp.prettier-vscode-11.0.0\dist\extension.js:1:18548)
	at t.default.getSelectors (c:\Users\xxx\.vscode\extensions\esbenp.prettier-vscode-11.0.0\dist\extension.js:1:12074)
	at t.default.handleActiveTextEditorChanged (c:\Users\xxx\.vscode\extensions\esbenp.prettier-vscode-11.0.0\dist\extension.js:1:11123)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions