Code Monkey home page Code Monkey logo

Comments (24)

axhamre avatar axhamre commented on June 7, 2024 2

My problem was that I had installed it with Yarn. Problem solved by:

yarn global remove prettier

And then install it with npm instead:

npm install -g prettier

from sublimejsprettier.

tsai-jimmy avatar tsai-jimmy commented on June 7, 2024 2

@atefBB yeah! great Job!

from sublimejsprettier.

rogy avatar rogy commented on June 7, 2024 1

@jonlabelle I had tried that also.

I get the exact same issue with my settings file being:

{
  "prettier_cli_path": "/Users/myuser/.nvm/versions/node/v7.9.0/bin/prettier",
  "node_path": "/Users/myuser/.nvm/versions/node/v7.9.0/bin/node"
}

from sublimejsprettier.

atefBB avatar atefBB commented on June 7, 2024 1

@tsai-jimmy thx for your help !

from sublimejsprettier.

jonlabelle avatar jonlabelle commented on June 7, 2024

The $HOME variable won't be automatically expanded. Also, you'll need to specify absolute paths when using NVM, for both prettier_cli_path and node_path.

from sublimejsprettier.

JemarJones avatar JemarJones commented on June 7, 2024

@hundsim I can confirm the same thing, this only seems to work when installed with npm.

from sublimejsprettier.

atefBB avatar atefBB commented on June 7, 2024

Hey @hundsim I use to install prettier globally with npm but still having the same issue.
Any ideas?

from sublimejsprettier.

jlc467 avatar jlc467 commented on June 7, 2024

@atefBB can you post your JsPrettier.sublime-settings ?

from sublimejsprettier.

atefBB avatar atefBB commented on June 7, 2024

@jlc467 this is my JsPrettier.sublime-settings file:
{ "debug": false, "prettier_cli_path": "C:/Users/.../AppData/Roaming/npm/prettier", "node_path": "C:/laragon/bin/nodejs/node-v6.11.0-x64/node.exe", "auto_format_on_save": false, "auto_format_on_save_excludes": [ "*/node_modules/*", "*/.git/*" ], "allow_inline_formatting": false, "custom_file_extensions": [], "max_file_size_limit": -1, "additional_cli_args": {}, "prettier_options": { "printWidth": 80, "singleQuote": false, "trailingComma": "none", "bracketSpacing": true, "jsxBracketSameLine": false, "parser": "babylon", "semi": true, "requirePragma": false } }

from sublimejsprettier.

jlc467 avatar jlc467 commented on June 7, 2024

Have you tried leaving node_path and prettier_cli_path empty?

I would also try running npm i prettier inside the JsPrettier package folder (Sublime Preferences -> Browse Packages -> JsPrettier). JsPrettier will look there by default if you leave prettier_cli_path empty.

It would also help if you posted the exact error message you are getting.

from sublimejsprettier.

atefBB avatar atefBB commented on June 7, 2024

I do but the issue still occurs !

from sublimejsprettier.

tsai-jimmy avatar tsai-jimmy commented on June 7, 2024

The prettier DOC has this :

nvm users are required to set an appropriate absolute `prettier_cli_path`
(and absolute `node_path`), according to the target runtime environment.

Because we use nvm ,so we should setting absolute path that where node and prettier is.

Open your terminal and follow this command:
which node
which prettier

image

from sublimejsprettier.

atefBB avatar atefBB commented on June 7, 2024

Hey, @tsai-jimmy I'm a Windows User!
copy paths from where node/prettier to prettier_cli_path/node_path ?

from sublimejsprettier.

atefBB avatar atefBB commented on June 7, 2024

The issue still occurs after copying paths to prettier_cli_path/node_path!

from sublimejsprettier.

tsai-jimmy avatar tsai-jimmy commented on June 7, 2024

Can you upload your screenshot about the setting where you copy and Paste!
command : which node
Next step : paste at node_path

{
  "prettier_cli_path": "past/your/path",
  "node_path": "past/your/path/to/node_path"
}

same as another "prettier_cli_path"

from sublimejsprettier.

tsai-jimmy avatar tsai-jimmy commented on June 7, 2024

Oh ! Are you used nvm to control your node version?

from sublimejsprettier.

atefBB avatar atefBB commented on June 7, 2024

node_prettier_cli_paths

I don't use nvm to control node versions !
I use node v8.9.3.

from sublimejsprettier.

tsai-jimmy avatar tsai-jimmy commented on June 7, 2024

Wait..
If you didn't use NVM ,so you didn't need to set the absolute path.
which methods you installed the plugin prettier before?
npm insall or use sublime command package control : install package

from sublimejsprettier.

atefBB avatar atefBB commented on June 7, 2024

@tsai-jimmy Did you mean that I should install node separately? node and prettier are already installed.

from sublimejsprettier.

tsai-jimmy avatar tsai-jimmy commented on June 7, 2024

hey, you set the node_path to blank

{
  "prettier_cli_path": "past/your/path",
  "node_path": ""
}

go to your javascript file ,run JsPrettier Format Code!
and you also face this error?
FileNotFoundError: [Errno 2] No such file or directory: 'prettier'

image
okay, you should find the really path at prettier!

if you face this error FileNotFoundError: [Errno 2] No such file or directory: 'node
image
Okay, your prettier_cli_path has been correct! and find out your path to node!

I'm mac developer, because I face lots of problem with windows before!
and I used NVM.
Sorry, I don't know what problems you truly faced...
but I recommend you to use NVM and you can manage your node and npm version!
Of course, manage where the position of plugin you use npm installed
,and your folder will be more clear !
At same environment maybe we can resolves your problem!

this is my absolute path
image

from sublimejsprettier.

tsai-jimmy avatar tsai-jimmy commented on June 7, 2024

oh you can go to your sublime to open console!
View/ show console

from sublimejsprettier.

atefBB avatar atefBB commented on June 7, 2024

when I use this "prettier_cli_path": "C:/Users/MyUserAccount/AppData/Roaming/npm/prettier.cmd", the issue is gone !

from sublimejsprettier.

lock avatar lock commented on June 7, 2024

This thread 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 sublimejsprettier.

jonlabelle avatar jonlabelle commented on June 7, 2024

See solution.

from sublimejsprettier.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.