Comments (24)
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.
@atefBB yeah! great Job!
from sublimejsprettier.
@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.
@tsai-jimmy thx for your help !
from sublimejsprettier.
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.
@hundsim I can confirm the same thing, this only seems to work when installed with npm.
from sublimejsprettier.
Hey @hundsim I use to install prettier
globally with npm
but still having the same issue.
Any ideas?
from sublimejsprettier.
@atefBB can you post your JsPrettier.sublime-settings ?
from sublimejsprettier.
@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.
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.
I do but the issue still occurs !
from sublimejsprettier.
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
from sublimejsprettier.
Hey, @tsai-jimmy I'm a Windows User!
copy paths from where node/prettier
to prettier_cli_path
/node_path
?
from sublimejsprettier.
The issue still occurs after copying paths to prettier_cli_path
/node_path
!
from sublimejsprettier.
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.
Oh ! Are you used nvm to control your node version?
from sublimejsprettier.
I don't use nvm to control node versions !
I use node v8.9.3
.
from sublimejsprettier.
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.
@tsai-jimmy Did you mean that I should install node
separately? node
and prettier
are already installed.
from sublimejsprettier.
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'
okay, you should find the really path at prettier!
if you face this error FileNotFoundError: [Errno 2] No such file or directory: 'node
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!
from sublimejsprettier.
oh you can go to your sublime to open console!
View/ show console
from sublimejsprettier.
when I use this "prettier_cli_path": "C:/Users/MyUserAccount/AppData/Roaming/npm/prettier.cmd",
the issue is gone !
from sublimejsprettier.
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.
See solution.
from sublimejsprettier.
Related Issues (20)
- auto_format_on_save doesn't work with prettier-php, but my manual keybind does. HOT 2
- Saving a php document with cursor inside a script tag causes cursor to jump to top of document HOT 2
- Svelte support + bug HOT 4
- JsPrettier’s parser detection interferes with the Liquid Prettier plugin HOT 3
- Fails to work with ruby files using @prettier/plugin-ruby HOT 2
- Allow unsaved files to be formatted with prettier without saving HOT 4
- SyntaxError: Invalid or unexpected token HOT 6
- Problem formatting .svelte files HOT 3
- Add Support For ESLinter Configurations HOT 2
- Support not passing any Prettier config CLI options even when *not* using a Prettier config file HOT 3
- Crash when low on memory HOT 2
- JsPrettier cannot find plugin HOT 5
- Switch to `--log-level` Prettier CLI option name is needed HOT 2
- Prettier cannot find plugin HOT 6
- [Question] I could not format css, json... HOT 7
- JsPrettier doesn't run in appropriate context when used in monorepo context HOT 1
- Support ESM config files HOT 2
- Doesn't work when folder names use parentheses (Next.js route groups) HOT 7
- [error] Invalid configuration file: ENOENT: no such file or directory ... HOT 2
- [Bug] Configuration overrides are not honored HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sublimejsprettier.