简体   繁体   English

JsPrettier关于Sublime文本[OSX]

[英]JsPrettier on Sublime text [OSX]

I tried to install auto_format_on_save using JSPrettier on my Sublime text. 我尝试在Sublime文本上使用JSPrettier安装auto_format_on_save。 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. 对于我所读的内容,是因为我使用的是oh-my-zhnvm但是我无法成功正确配置我的安装文件。

Please help 请帮忙

which node :: /Users/mymac/.nvm/versions/node/v9.5.0/bin/node 哪个节点:: /Users/mymac/.nvm/versions/node/v9.5.0/bin/node

Thanks for helping 感谢您的帮助

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). 尝试在JsPrettier - User settings设置node_path ,以指向$ which node输出的绝对路径(对于要使用插件的任何版本的Node)。

You might also try setting prettier_cli_path similarly to the output of $ which prettier . 您也可以尝试设置prettier_cli_path ,与设置$ 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. node_path (默认值: empty )如果Sublime Text无法解析节点的绝对路径,则可以在此处设置自定义路径。

nvm users must set an appropriate absolute node_path (and absolute prettier_cli_path ), according to the runtime environment. NVM用户必须设定适当的绝对node_path (和绝对prettier_cli_path ),根据该运行时环境。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM