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.

Extension 'Prettier - Code formatter' cannot format ....

See original GitHub issue

Summary

Even I set format on save and prettier as a default formatter, when I save my code it isn’t fixed. It shows error ‘Extension ‘Prettier - Code formatter’ cannot format …’

Github Repository to Reproduce Issue

https://github.com/Namukk/nomflix

Steps To Reproduce:

  1. Clone code
  2. Try to save it

Expected result

It should fix my code. Even I downloaded extensions and vscode again It shows same error.

Actual result

It doesn’t fix my code with error Extension 'Prettier - Code formatter' cannot format ....

Additional information

스크린샷 2021-03-14 오후 10 30 18

VS Code Version: 1.54.2

Prettier Extension Version: 6.2.0

OS and version: macOs Big Sur 11.2.3

Prettier Log Output

["INFO" - 2:50:38 PM] Extension Name: esbenp.prettier-vscode.
["INFO" - 2:50:38 PM] Extension Version: 6.2.0.
["INFO" - 2:50:38 PM] Enabling Prettier globally
["INFO" - 2:50:38 PM] Globally enabled selectors
{
  "languageSelector": [
    {
      "language": "javascript",
      "scheme": "file"
    },
    {
      "language": "mongo",
      "scheme": "file"
    },
    {
      "language": "javascriptreact",
      "scheme": "file"
    },
    {
      "language": "typescript",
      "scheme": "file"
    },
    {
      "language": "typescriptreact",
      "scheme": "file"
    },
    {
      "language": "json",
      "scheme": "file"
    },
    {
      "language": "jsonc",
      "scheme": "file"
    },
    {
      "language": "json5",
      "scheme": "file"
    },
    {
      "language": "css",
      "scheme": "file"
    },
    {
      "language": "postcss",
      "scheme": "file"
    },
    {
      "language": "less",
      "scheme": "file"
    },
    {
      "language": "scss",
      "scheme": "file"
    },
    {
      "language": "graphql",
      "scheme": "file"
    },
    {
      "language": "markdown",
      "scheme": "file"
    },
    {
      "language": "mdx",
      "scheme": "file"
    },
    {
      "language": "html",
      "scheme": "file"
    },
    {
      "language": "vue",
      "scheme": "file"
    },
    {
      "language": "yaml",
      "scheme": "file"
    },
    {
      "language": "ansible",
      "scheme": "file"
    },
    {
      "language": "home-assistant",
      "scheme": "file"
    },
    {
      "language": "javascript",
      "scheme": "untitled"
    },
    {
      "language": "mongo",
      "scheme": "untitled"
    },
    {
      "language": "javascriptreact",
      "scheme": "untitled"
    },
    {
      "language": "typescript",
      "scheme": "untitled"
    },
    {
      "language": "typescriptreact",
      "scheme": "untitled"
    },
    {
      "language": "json",
      "scheme": "untitled"
    },
    {
      "language": "jsonc",
      "scheme": "untitled"
    },
    {
      "language": "json5",
      "scheme": "untitled"
    },
    {
      "language": "css",
      "scheme": "untitled"
    },
    {
      "language": "postcss",
      "scheme": "untitled"
    },
    {
      "language": "less",
      "scheme": "untitled"
    },
    {
      "language": "scss",
      "scheme": "untitled"
    },
    {
      "language": "graphql",
      "scheme": "untitled"
    },
    {
      "language": "markdown",
      "scheme": "untitled"
    },
    {
      "language": "mdx",
      "scheme": "untitled"
    },
    {
      "language": "html",
      "scheme": "untitled"
    },
    {
      "language": "vue",
      "scheme": "untitled"
    },
    {
      "language": "yaml",
      "scheme": "untitled"
    },
    {
      "language": "ansible",
      "scheme": "untitled"
    },
    {
      "language": "home-assistant",
      "scheme": "untitled"
    }
  ],
  "rangeLanguageSelector": [
    {
      "language": "javascript",
      "scheme": "file"
    },
    {
      "language": "javascriptreact",
      "scheme": "file"
    },
    {
      "language": "typescript",
      "scheme": "file"
    },
    {
      "language": "typescriptreact",
      "scheme": "file"
    },
    {
      "language": "json",
      "scheme": "file"
    },
    {
      "language": "graphql",
      "scheme": "file"
    },
    {
      "language": "javascript",
      "scheme": "untitled"
    },
    {
      "language": "javascriptreact",
      "scheme": "untitled"
    },
    {
      "language": "typescript",
      "scheme": "untitled"
    },
    {
      "language": "typescriptreact",
      "scheme": "untitled"
    },
    {
      "language": "json",
      "scheme": "untitled"
    },
    {
      "language": "graphql",
      "scheme": "untitled"
    }
  ]
}
["INFO" - 2:50:38 PM] Using bundled version of prettier.
["INFO" - 2:50:38 PM] Enabling Prettier for Workspace /Users/Namuk/Documents/github/nomflix
["INFO" - 2:50:38 PM] Workspace enabled selectors
{
  "languageSelector": [
    {
      "pattern": "/Users/Namuk/Documents/github/nomflix/**/*.*",
      "scheme": "file",
      "language": "javascript"
    },
    {
      "pattern": "/Users/Namuk/Documents/github/nomflix/**/*.*",
      "scheme": "file",
      "language": "mongo"
    },
    {
      "pattern": "/Users/Namuk/Documents/github/nomflix/**/*.*",
      "scheme": "file",
      "language": "javascriptreact"
    },
    {
      "pattern": "/Users/Namuk/Documents/github/nomflix/**/*.*",
      "scheme": "file",
      "language": "typescript"
    },
    {
      "pattern": "/Users/Namuk/Documents/github/nomflix/**/*.*",
      "scheme": "file",
      "language": "typescriptreact"
    },
    {
      "pattern": "/Users/Namuk/Documents/github/nomflix/**/*.*",
      "scheme": "file",
      "language": "json"
    },
    {
      "pattern": "/Users/Namuk/Documents/github/nomflix/**/*.*",
      "scheme": "file",
      "language": "jsonc"
    },
    {
      "pattern": "/Users/Namuk/Documents/github/nomflix/**/*.*",
      "scheme": "file",
      "language": "json5"
    },
    {
      "pattern": "/Users/Namuk/Documents/github/nomflix/**/*.*",
      "scheme": "file",
      "language": "css"
    },
    {
      "pattern": "/Users/Namuk/Documents/github/nomflix/**/*.*",
      "scheme": "file",
      "language": "postcss"
    },
    {
      "pattern": "/Users/Namuk/Documents/github/nomflix/**/*.*",
      "scheme": "file",
      "language": "less"
    },
    {
      "pattern": "/Users/Namuk/Documents/github/nomflix/**/*.*",
      "scheme": "file",
      "language": "scss"
    },
    {
      "pattern": "/Users/Namuk/Documents/github/nomflix/**/*.*",
      "scheme": "file",
      "language": "graphql"
    },
    {
      "pattern": "/Users/Namuk/Documents/github/nomflix/**/*.*",
      "scheme": "file",
      "language": "markdown"
    },
    {
      "pattern": "/Users/Namuk/Documents/github/nomflix/**/*.*",
      "scheme": "file",
      "language": "mdx"
    },
    {
      "pattern": "/Users/Namuk/Documents/github/nomflix/**/*.*",
      "scheme": "file",
      "language": "html"
    },
    {
      "pattern": "/Users/Namuk/Documents/github/nomflix/**/*.*",
      "scheme": "file",
      "language": "vue"
    },
    {
      "pattern": "/Users/Namuk/Documents/github/nomflix/**/*.*",
      "scheme": "file",
      "language": "yaml"
    },
    {
      "pattern": "/Users/Namuk/Documents/github/nomflix/**/*.*",
      "scheme": "file",
      "language": "ansible"
    },
    {
      "pattern": "/Users/Namuk/Documents/github/nomflix/**/*.*",
      "scheme": "file",
      "language": "home-assistant"
    },
    {
      "pattern": "/Users/Namuk/Documents/github/nomflix/**/*.{js,_js,bones,cjs,es,es6,frag,gs,jake,jsb,jscad,jsfl,jsm,jss,mjs,njs,pac,sjs,ssjs,xsjs,xsjslib,wxs,js.flow,jsx,ts,tsx,json,avsc,geojson,gltf,har,ice,JSON-tmLanguage,mcmeta,tfstate,tfstate.backup,topojson,webapp,webmanifest,yy,yyp,jsonc,sublime-build,sublime-commands,sublime-completions,sublime-keymap,sublime-macro,sublime-menu,sublime-mousemap,sublime-project,sublime-settings,sublime-theme,sublime-workspace,sublime_metrics,sublime_session,json5,css,wxss,pcss,postcss,less,scss,graphql,gql,graphqls,md,markdown,mdown,mdwn,mkd,mkdn,mkdown,ronn,workbook,mdx,component.html,html,htm,html.hl,inc,st,xht,xhtml,mjml,vue,yml,mir,reek,rviz,sublime-syntax,syntax,yaml,yaml-tmlanguage,yaml.sed,yml.mysql}",
      "scheme": "file"
    }
  ],
  "rangeLanguageSelector": [
    {
      "language": "javascript"
    },
    {
      "language": "javascriptreact"
    },
    {
      "language": "typescript"
    },
    {
      "language": "typescriptreact"
    },
    {
      "language": "json"
    },
    {
      "language": "graphql"
    }
  ]
}
["INFO" - 2:50:57 PM] Using bundled version of prettier.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:20 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
ntottencommented, Mar 15, 2021

@jwoLondon The value "/Users/XXXX/.nvm/versions/node/v12.16.2/bin" is not a valid value for prettier.prettierPath. It needs to be to the module path not the bin path.

See: https://github.com/prettier/prettier-vscode#prettierprettierpath

0reactions
github-actions[bot]commented, Jun 18, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why does Prettier not format code in VS Code? - Stack Overflow
Click on Preferences: Open Settings (JSON) from the suggestion dropdown. Inside the settings.json file, Check if "[html]" key exists. If the key ...
Read more >
How to fix Prettier Extension not working issue in VS CODE
Your browser can't play this video. Learn more. Switch camera.
Read more >
Prettier extension not working on HTML files : r/vscode - Reddit
First make sure that you don't have multiple extensions to format html files. Uninstall the ones that you don't need - or at...
Read more >
VS Code - You don't need a formatting ... - DEV Community ‍ ‍
The built-in CSS extension now ships with a formatter. ... I don't use React, so I can't comment how well React code is...
Read more >
VS Code - You don't need a formatting ... - Rob O'Leary
You configure how the formatting is done with the following settings: css.format.enable - Enable/disable default CSS formatter. css.format.
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