Comments (23)
I've seen it, the fix is here #74
As a current workaround, be sure your package.json contains dependencies
and devDependencies
. They may be empty {}
from prettier-vscode.
I got this exact same problem after updating.
EDIT:
I got it to work by adding "prettier": "^1.1.10"
to devDependencies
and do npm install
from prettier-vscode.
Hi @CiGit,
Mi package.json
has dependencies
and devDependencies
objects with many properties.
from prettier-vscode.
I've also checked the prettier package.json
included with the extension and it's not empty either.
from prettier-vscode.
Can you also check in parent package.json if any?
from prettier-vscode.
I'm having the same problem after the update.
from prettier-vscode.
Also no package.json
without dependencies and devDependencies?
on the path from /
to your file ?
from prettier-vscode.
@CiGit the parent package.json also appears OK, with the dependencies properly declared (esbenp.prettier-vscode-0.13.0/package.json
):
from prettier-vscode.
I was meaning in package.json located along the path
/
package.json
a/
package.json
b/
.....
workspace
package.json
dir/
fileToFormat.js
This are the place where it could occur.
from prettier-vscode.
@CiGit There only 1 package.json
in my project tree is a CRA(create-react-app) and goes as follow:
/ProjectRoot
/node_modules
/src
myfileToFormat.js
package.json (My project. No empty deps objects)
the only additional package.json
files are the ones related to the proper project dependencies but they're in the node_modules
directory which is not along my src files path.
Is it more clear now?
from prettier-vscode.
I still don't know where it can come from. Is it possible for you to debug it? I won't ask your entire file system 😈
from prettier-vscode.
Like @JesusIslam - things resolved for me when installing Prettier locally into the repo. So it seems like VSCode might not be checking for a globally installed copy and defaulting to that?
from prettier-vscode.
@jtulk #67 seems right, it needs to be explicitly installed now.
from prettier-vscode.
Indeed!
I installed prettier as devDependency and the problem was solved.
It would be excellent to add a note in the readme.md
that prettier needs to be available as a dependency for the project or at least installed as a global (I didn't check if it works when prettier is installed as global module).
from prettier-vscode.
@mogarick it didn't work as a global for me at least.
from prettier-vscode.
Just published 0.13.1 with a patch that should correct this issue. At least what I could reproduce.
@esbenp I finally found out how to publish ... was really tough
from prettier-vscode.
@CiGit - Does the patch require a local install or will it work off a global install now? I'll be happy to do a PR to annotate the docs if it requires a local copy...
from prettier-vscode.
It loads prettier packed with the extension if there is no local install. It doesn't use your globally installed prettier.
PR welcome to update https://github.com/esbenp/prettier-vscode#prettier-resolution ;-)
from prettier-vscode.
I just hit this today VSCode Version 1.16.1, prettier-vscode 0.24.0 and had to install prettier locally to fix it (npm i -D prettier
) it was working fine without that previously...
from prettier-vscode.
@tizmagik How was your setup before you installed prettier? Stack trace?
from prettier-vscode.
Where would the stacktrace be? All I saw was the Cannot read property 'prettier' of undefined message in the output tab
from prettier-vscode.
Damn, I also forgot some informations here. I meant debug it :-)
clone it, npm i, open it in vscode and F5 (Start debugging)
from prettier-vscode.
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.
from prettier-vscode.
Related Issues (20)
- Editor scrolls to bottom when format large file using prettier HOT 1
- Extension only looks for .gitignore or .prettierignore when using Prettier v3, does not allow both
- Use LanguageStatusItem API for the status bar item HOT 1
- prettier bug in Vue
- Prettier extension deletes line of code after pasting
- icons
- Prettier doesn't appear in the list of formatters HOT 5
- Installed Prettier extension does not format and gives following error: Cannot find module 'prettier' HOT 1
- `prettier-vscode` doesn't respond to changes in `prettier.config.mjs` until the workspace reloads HOT 4
- Cannot use any prettier plugins with `yarn 4 + PnP`
- Do not put css comments on new line HOT 1
- I have done all kinds of things but my prettier does not format on save. HOT 1
- I need to completely uninstall prettier an reinstall it. HOT 1
- Title: Feature Request: Improved Support for C Language in Prettier Extension
- Prettier does not format in multi-folder repositories whilst using the .code-workspace config. HOT 1
- Use NODE_COMPILE_CACHE when detecting node v22+
- Extension causes high cpu load
- experimentalTernaries not respected using prettier-vscode plugin HOT 1
- When I set Prettier: Single Attribute Per Line, the css style in the <style> tag of the vue file was invalid.
- in bash file a piece of code is treated like a comment
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prettier-vscode.