-
-
Notifications
You must be signed in to change notification settings - Fork 461
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
failed to load prettier from package.json #1066
Comments
Same here. It made VSCode so unstable ("Host extension" kept dying), that I had to uninstall the extension. Note that I use a workspace with lots of projects in it, so that may be a problem. |
i had the same problem, after update vscode , just updated devDependencies. eslint, prettier, and now working |
Can we fallback to global installed |
@JounQin - the problem isn't really that it couldn't find |
@giltayar Maybe you're right there. But we sometimes will work on projects without |
Definitely! But that's another issue, and not this one... 😊
…On Mon, Nov 18, 2019, 07:24 JounQin ***@***.***> wrote:
@giltayar <https://github.com/giltayar> Maybe you're right there. But we
sometimes will work on projects without package.json, ruby app for
example, it should be supported out of box.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1066?email_source=notifications&email_token=AADCORF2TXCEHJRHCFFXMFDQUIRINA5CNFSM4JOJGGRKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEJHDQY#issuecomment-554856899>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADCOREISEQRO2N3AEH5E2TQUIRINANCNFSM4JOJGGRA>
.
|
@giltayar You're right again, haha. |
Could somebody provide a sample github repo i can use to duplicate this error. It seems like this is something you are seeing in large monorepos maybe. |
@ntotten Can you try eslint-mdx? |
@ntotten - unfortunately, the repo this happens in is closed-source, so I can't show this. But this is the prettier extension log from there: https://gist.github.com/giltayar/0522c58f252140c79c739abd9c56cb8e I tried it, BTW, with another monorepo of mine (open-source), but unfortunately there were no problems there. |
The For now, you can solve it by setting 1. Install Prettier Globally via npm if you have never installed it globally npm i prettier -g 2. Search & Use the // You can navigate to VS Code 3. Update the For Example
|
There seem to be a few different issues going on here.
|
Similar problem here. None of the issues mentioned in the previous issue apply. Unfortunately, this is also a closed-source application. I will note, however, that my stylesheets are in a folder that has a |
I'm confused, is |
@JosNun In your case that is likely going to be the problem. The extension searches the tree down until we file a package.json. If that package.json contains prettier, the extension uses that, otherwise it will fall back to using the bundled version of prettier. You may want to install prettier as a devDepandancy in that package.json. |
@ntotten all the packages in my vscode workspace have prettier installed as a dev dependency. And yes, they are all mostly updated to latest version of prettier (3.1.x and in two cases 2.7.x). And the log you saw was probably mine, so something weird is going on here. |
Yes, it walks down the tree and uses the closest package.json. If that package.json has prettier, it will use that otherwise it will fall back to the bundled version. |
whew okay. It seemed that after I updated prettier in my package I had to restart VSCode to get prettier-vscode to use the new installed version. |
Oh, wait. I looked at the versions of Yes, I had outdated <1.13 packages in my workspace. Unfortunately, I upgraded them, and same problem. Here is the new log: https://gist.github.com/giltayar/36aa345c64e222c4006acc3621d3baf7 |
One thing to check is if there are encoding issues in either the I added some additional logging as well in v3.11.0 to report these kinds of errors. Let me know if anyone sees this. |
Nope, sorry. This is my latest (prettier extension 3.11.0) log: https://gist.github.com/giltayar/c5bb12727d5c9bb4adc0cb3b67dd54a8 But I think I know what's going on (in my repo, at least). Some packages in my monorepo are not But this has always been so. Why is the problem popping up now? It's an amalgamation of two problems:
Since the microsoft/vscode#84803 issue has been fixed in the latest vscode release, I still get the error messages, but I can safely ignore them as VS Code continues to to run. For me, this is good enough. I have prettier back! :-) |
Nope, sorry. Still getting host termination exceptions, and only if I enable the prettier extension. Have to disable it yet again... :-( |
@giltayar im not really sure why you are seeing the extension host crash. The “errors” in the prettier extension log are handled and not going to cause a crash. They are simply being logged. Can you provide any details on what the exception host logs or shows before the crash. I think the errors in the prettier log are probably a false flag and not the actual cause. The only result from those errors should be that formatting doesn’t happen in those parts of the monorepo. I know your project is closed source, but if you can provide a different repo that can duplicate that issue, that would help. As is, I don’t have enough information to solve this problem. |
I get this same error message, not on my js/ts files but only when I save my package.json. prettier is there in a recent version. I've even tried to disable formatting on json but this still happens. These are my relevant workspace settings:
Seems to me that the plugin has registered itself as a formatter for lots of languages and when going down from package.json it doesn't find itself?
|
I was having this problem, too. When I tried to install prettier globally, I would get this error:
Seems it somehow couldn't detect the version number of the globally installed prettier... I then realized my project is using yarn pnp, so maybe that's why it couldn't find the prettier from package.json. I did |
Sometimes I just want open files and reading some repo source code rather than run npm install. This repo could using prettier in package.json but I don't want install I just reading source code to study, and I don't want create a sorry, poor English... |
System Config: |
This has been really hectic. Been happening for a couple of weeks & now I got frustrated 🤦♂️ Any way to solve this? @tunjioye your solution didn’t work for me. I used |
WOW. |
@tunjioye I already did, it’s installed FWIW |
@tunjioye Just want to point out the obvious - installing globally is very much a workaround. I'm always trying to minimize any kind of global installs on a dev machine to the bare minimum. Prettier is a big no-no to install globally for me. A plugin like this needs to be able to use the prettier version from the module at hand. |
I am really going to need somebody to provide a sample GitHub repo that I can use to reproduce this otherwise it really isn’t clear what is happening. I think this issue has evolved into a discussion of multiple, separate issues. Please provide repro steps and a sample. |
@ntotten I tried to install And is eslint-mdx not simple enough for reproduction? |
@JounQin I ran eslint-mdx without any errors. So I am not able to reproduce the problem. Also, global modules are not supported unless you are setting the |
@ntotten I mean I both enabled |
I am going to close this issue. It has turned into a discussion of what I think are many related issues and I cannot keep up. Please open a new issue with repro steps and a sample project along will all other valid information. Thanks! |
Summary
I receive an error when I open package.json file from VS Code
Steps To Reproduce:
and create
~/.prettierrc.yml
:Expected result
I would open package.json with no errors
Actual result
It dropped this error:
Also in logs I saw this:
Additional information
VS Code Version: 1.40.0
Prettier & Prettier Plugin Version: 3.6.0
OS and version: Manjaro, Linux 4.19.84
The text was updated successfully, but these errors were encountered: