Search code examples
sublimetext3jsprettier

JsPrettier on Sublime text [OSX]


I tried to install auto_format_on_save using JSPrettier on my Sublime text. But everytime i'm saving my file, i get :

------------------
 JsPrettier ERROR 
------------------

Prettier reported the following error(s):

env: node: No such file or directory

Process finished with exit code 127

For what i've read, it is because i'm using oh-my-zh and nvm but i don't succeed to configure my setup files properly.

Please help

which node :: /Users/mymac/.nvm/versions/node/v9.5.0/bin/node

Thanks for helping


Solution

  • Try setting node_path in your JsPrettier - User settings to point to the absolute path output by $ which node (for whatever version of Node you want the plugin to use).

    You might also try setting prettier_cli_path similarly to the output of $ which prettier.

    I pulled this from Settings in the extension docs:

    node_path (default: empty) If Sublime Text has problems resolving the absolute path to node, you can set a custom path here.

    nvm users must set an appropriate absolute node_path (and absolute prettier_cli_path), according to the runtime environment.

    https://github.com/jonlabelle/SublimeJsPrettier#settings