question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Plugin settings are not recognized

See original GitHub issue

Summary

All plugins for Prettier are not recognized by vscode prettier and I get a Cannot find module error.

Github Repository to Reproduce Issue

https://github.com/logue/vite-vue2-ts-starter

Currently, this issue intentionally comments out the plugin settings.

Steps To Reproduce:

  1. Install the plugin for any pretter in your project.
  2. Fill in the prettierrc plugins with any plugins you have installed.

The settings in .prettierrc.yml are as follows:

printWidth: 80
tabWidth: 2
useTabs: false
semi: true
singleQuote: true
trailingComma: es5
bracketSpacing: true
bracketSameLine: false
arrowParens: avoid
htmlWhitespaceSensitivity: ignore
endOfLine: lf
plugins:
  - prettier-plugin-jsdoc
  - prettier-plugin-md-nocjsp
  - prettier-plugin-sort-imports

Expected result

The plugin settings are also reflected in prettier-vscode, and formatting is performed based on it.

Actual result

When the plugin is configured, its contents are not recognized and the error Cannot find module is raised.

It does not occur if you comment out all the plugin lines.

Additional information

I have confirmed that running prettier directly from the command line in the project root works without problems.

VS Code Version:

バージョン: 1.64.2 (system setup)
コミット: f80445acd5a3dadef24aa209168452a3d97cc326
 日付: 2022-02-09T22:02:28.252Z
Electron: 13.5.2
Chromium: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Windows_NT x64 10.0.22000

Prettier Extension Version:

9.2.0

OS and version:

Windows 11

Prettier Log Output

["INFO" - 16:54:00] Detected local configuration (i.e. .prettierrc or .editorconfig), VS Code configuration will not be used
["INFO" - 16:54:00] Prettier Options:
{
  "filepath": "[PROJECT DIRECTORY]\\.prettierrc.yml",
  "parser": "yaml",
  "useTabs": false,
  "tabWidth": 2,
  "endOfLine": "lf",
  "printWidth": 80,
  "semi": true,
  "singleQuote": true,
  "trailingComma": "es5",
  "bracketSpacing": true,
  "bracketSameLine": false,
  "arrowParens": "avoid",
  "htmlWhitespaceSensitivity": "ignore",
  "plugins": [
    "prettier-plugin-jsdoc",
    "prettier-plugin-md-nocjsp",
    "prettier-plugin-sort-imports"
  ]
}
["ERROR" - 16:54:00] Error formatting document.
["ERROR" - 16:54:00] Cannot find module 'prettier-plugin-jsdoc'
Require stack:
- [PROJECT DIRECTORY]\node_modules\prettier\index.js
- c:\Users\[USER NAME]\.vscode\extensions\esbenp.prettier-vscode-9.2.0\dist\extension.js
- c:\Program Files\Microsoft VS Code\resources\app\out\vs\loader.js
- c:\Program Files\Microsoft VS Code\resources\app\out\bootstrap-amd.js
- c:\Program Files\Microsoft VS Code\resources\app\out\bootstrap-fork.js
Error: Cannot find module 'prettier-plugin-jsdoc'
Require stack:
- [PROJECT DIRECTORY]\node_modules\prettier\index.js
- c:\Users\[USER NAME]\.vscode\extensions\esbenp.prettier-vscode-9.2.0\dist\extension.js
- c:\Program Files\Microsoft VS Code\resources\app\out\vs\loader.js
- c:\Program Files\Microsoft VS Code\resources\app\out\bootstrap-amd.js
- c:\Program Files\Microsoft VS Code\resources\app\out\bootstrap-fork.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:934:15)
    at h.resolve (c:\Program Files\Microsoft VS Code\resources\app\out\vs\loader.js:4:761)
    at [PROJECT DIRECTORY]\node_modules\prettier\index.js:60885:21
    at Array.map (<anonymous>)
    at Object.load ([PROJECT DIRECTORY]\node_modules\prettier\index.js:60877:61)
    at Object.load [as loadPlugins] ([Path to Project Directory]\node_modules\prettier\index.js:16258:23)
    at [PROJECT DIRECTORY]\node_modules\prettier\index.js:60957:24
    at Object.Success [as format] ([Path to Project Directory]\node_modules\prettier\index.js:60979:12)
    at t.default.format (c:\Users\[USER NAME]\.vscode\extensions\esbenp.prettier-vscode-9.2.0\src\PrettierEditService.ts:435:45)
    at t.PrettierEditProvider.provideEdits (c:\Users\[USER NAME]\.vscode\extensions\esbenp.prettier-vscode-9.2.0\src\PrettierEditService.ts:322:22)
    at g.provideDocumentFormattingEdits (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:93:98509)
["INFO" - 16:54:00] Formatting completed in 0.008ms.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:4
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

6reactions
KillDozerX2commented, Mar 9, 2022

The vscode extension has been having issues with applying plugins to prettier.

1reaction
JounQincommented, Jun 29, 2022

@logue

A single "prettier": "^2.7.1" would work, but eslint-plugin-prettier@v4.1.0 is preferred to be installed because of its new feature.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fixing “This Plugin is Not Supported” error in Windows 10/11
1. Enable Flash in Chrome. 2. Install the latest Flash player; Update Flash:Clear the browsing data in Chrome. 3. Use another browser to...
Read more >
Fix Chrome Plugins Not Working in Windows 10 - TechCult
How to Fix Chrome Plugins Not Working in Windows 10 · Method 1: Restart Chrome · Method 2: Update Chrome · Method 3:...
Read more >
Trouble installing the plug-in? - Microsoft Support
Plug-in download fails · Go to Tools > Internet Options > Advanced. · Scroll down to the Security section. · Clear Do not...
Read more >
Elementor site settings not working when plugin activated
There is no link to “site settings” from the Elementor editing panel with the current version of this plugin activated on my client's...
Read more >
WordPress plugin not working? Check these 5 things - Yoast
1. Did you activate it? At the risk of stating the obvious: Did you activate the plugin? · 2. Check for conflicts with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found