prettier-vscode
prettier-vscode copied to clipboard
Command 'Format Document With...' resulted in an error (command 'npm.packageManager' not found)
Summary
It does works first them when i reinstall the extension. But when i reload the VS CODE it stops working again.
Github Repository to Reproduce Issue
Just use any Javascript File
Steps To Reproduce:
- CMD + SHIFT + P
- Format Document With
- Prettier Code Formatter
Expected result
It should format the code
Actual result
It's giving error Command 'Format Document With...' resulted in an error (command 'npm.packageManager' not found)
Additional information
Feel free to attach a screenshot.

VS Code Version: 1.55.2
Prettier Extension Version: 6.3.2
OS and version: OSX Catalina 10.15.6 (19G73
Prettier Log Output
["INFO" - 9:06:10 PM] Extension Name: esbenp.prettier-vscode.
["INFO" - 9:06:10 PM] Extension Version: 6.3.2.
["INFO" - 9:06:12 PM] Formatting /Volumes/D/www/php/wordpress/wp-content/plugins/analyzify/assets/analyzify-frontend.js
["INFO" - 9:06:12 PM] Using ignore file (if present) at /Volumes/D/www/php/wordpress/.prettierignore
["INFO" - 9:09:33 PM] Formatting /Volumes/D/www/php/wordpress/wp-content/plugins/analyzify/assets/analyzify-frontend.js
["INFO" - 9:09:33 PM] Using ignore file (if present) at /Volumes/D/www/php/wordpress/.prettierignore
I am not able to reproduce this issue. A lot of the time these issues are caused by various version and config settings that are difficult to duplicate. Please provide a sample Github repo that I can use to duplicate this issue. For more details see this guide.
@ntotten check this repo https://github.com/khanakia/prettier_issue
Here's the debug Log
["INFO" - 8:32:50 AM] Extension Name: esbenp.prettier-vscode.
["INFO" - 8:32:50 AM] Extension Version: 6.3.2.
["INFO" - 8:32:50 AM] Enabling Prettier globally
{
"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"
},
{
"language": "jsonc",
"scheme": "vscode-userdata"
}
],
"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" - 8:32:53 AM] Formatting /Users/khanakia/Downloads/prettier_issue/demo.js
["INFO" - 8:32:53 AM] Using ignore file (if present) at /Users/khanakia/Downloads/prettier_issue/.prettierignore
@ntotten I think i found the issue 👍 when i have this config is set to true "prettier.resolveGlobalModules": true then it gives the above mentioned error.
So please enable that setting and then test it also i am attaching the vscode settings.json file settings.json
Thanks for the added info. I'll check this ASAP and get a fix out. Hopefully in the next few days.
I am having the same issue on Arch Linux. Node installed with nvm. Integrated terminal shows correct node and nvm versions, so vscode seems to be aware of them. Added this to .bash_profile
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
and this to settings.json:
"terminal.integrated.shellArgs.linux": ["-l"]
Still no luck.
Also having "prettier.resolveGlobalModules": true in my settings
I'm having the same issue.
In my case, this occurs when package.json is not in the root folder. Eg,
<root>
└── app
├── package.json
└── index.js
@ntotten I think i found the issue 👍 when i have this config is set to true
"prettier.resolveGlobalModules": truethen it gives the above mentioned error.So please enable that setting and then test it also i am attaching the vscode settings.json file settings.json
This resolved it for me, thanks.
This issue has been labeled as stale due to inactivity. Reply to keep this issue open.
happened today, julia 1.8.5
Command 'Format Document With...' resulted in an error
Failed to format document: ErrorException("Error while PARSING formatted text:\n\n1 using LinearAlgebra\n2 .....
This issue has been labeled as stale due to inactivity. Reply to keep this issue open.
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.