Prettier doesn't work in IDEA 2019.2
Hello. I have some problems with prettier in my IDEA. Watch mode doesn't work for me. I use this instruction https://prettier.io/docs/en/webstorm.html and it doesn't work in watch mode. When I keypress Ctrl + S happens anything.
Moreover, hotkeys CTRL+ SHIPT+ALT+P doesn't work also. Although, I cheked it in hotkeys and it hotkey there are.
Sometimes I can see next error
```
/assets/node_modules/.bin/prettier --write assets/src/pages/HomePage.js
/usr/bin/env: ‘node’: No such file or directory
Process finished with exit code 127
```
And I set all necessary settings for prettier and node. I use nvm LTS node 10.16.3.
I have this problem with prettier on two my computers. And OS Ubuntu 18.04.3
Can we help me?
Please sign in to leave a comment.
>Sure, installed, reformatting works on save.
You must have it set up as a file watcher, it has nothing to do with the IDE Prettier plugin
>Shall we do it manually or WebStorm must do it?
You have to do it manually; see https://www.jetbrains.com/help/webstorm/2019.2/prettier.html#ws_prettier_configure
Very late too, but maybe I can help someone. Solution for those who use nvm
In my case nodejs was installed through nvm, and prettier had been throwing same error: /usr/bin/env: ‘node’: No such file or directory. I spent two hours for test solutions with symlinks and other stuff but it didn't help.
So, I executed echo $PATH and output looks like that: "/home/user/.nvm/versions/node/v12.16.1/bin:/home/user/WebstormProjects/project/node_modules/.bin..."
Then I just edited my Prettier File Watcher, namely set environment variable PATH for it manually with gotten global value (Tools | File Watchers | Edit Watcher | Environment variables).
That fixed this issue for me, Prettier works fine.
Sure, installed, reformatting works on save.
I didn't specify Prettier in Settings | Languages & Frameworks | JavaScript | Prettier.
Thanks! Specifying this solves the problem.
Shall we do it manually or WebStorm must do it? Asking, because there is nothing about it in Prettier docs.
>/usr/bin/env: ‘node’: No such file or directory
Looks like
node
is not on your$PATH
. Does the issue persist if your start IDEA from terminal, either with the command line launcher or withbin/idea.sh
?When being launched from desktop/System menu, IDEA only sees environment variables configured in login shell, but not in interactive shell configuration files (like
.bashrc
or.zshrc
).Possible workarounds:
- Workaround 1: make required variables available in a login shell by moving them to the corresponding shell profile config
- Workaround 2: run IDE from a terminal
- Workaround 3: edit the desktop launcher and set command to
/path/to/shell -l -i -c "/path/to/idea.sh"
(make sure that the shell you specified there has the needed variables configured in its interactive shell configuration file)see also https://youtrack.jetbrains.com/issue/IDEABKL-7589
Thanks, if I run IDE from a terminal prettier works on ctrl + s, but it doesn't work Ctrl + Shift + Alt + P also.
And I install snap package from ubuntu software.
>it doesn't work Ctrl + Shift + Alt + P also
Does it work if you choose Reformat with Prettier action from the file right-click menu using mouse (i.e. when not using shortcuts)?
If it doesn't, please share your idea.log (Help | Show Log in ...)
Note: please don't paste log content here, upload it to some file server and provide a link
No, it works when I use right menu. Do you need idea.log yet?
No; did you try assigning a different shortcut to this action? What system keyboard layout do you use?
It looks like this is a common issue when installing using Software Manager in distros such as Ubuntu or Mint. Had the same problem a couple of days ago.
I have the same problem with a hotkey - it doesn't work. Reassigned hotkey doesn't work either. Even more, there is no action "Reformat with Prettier" in Find action dialog, nor in the context menu. While reformating on save works well.
OS: Windows 10 x64
IDE version: 2019.2.1
IDE installation type: not clean, updating from previous versions.
Is Prettier plugin installed and enabled (check Settings | Plugins)? If yes, did you specify Prettier package in Settings | Languages & Frameworks | JavaScript | Prettier?
Thanks, Elena.
Needs to post an issue in Prettier.
Also, the plugin's page could have this info as well.
VERY late to the party but I ran into this Issue, and had recently done an upgrade of RubyMine. BUT THE UPGRADE was a RED HERRING.
If you have just/recently installed xcode, you need to accept the terms/conditions in terminal in order to resource or source your bash profile. Run `source ~/.bash_profile` to get instructions on how to accept the terms.
The shell in RubyMine wasn't able to load $PATH due to the xcode blocker. That fixed this issue for me.
@... Thanks, worked for me
@... Thanks a lot my friend, your solution also worked for me! For me personally, it is the most elegant way how to resolve this issue :)
@... - worked for me too - Thanks!