yasuyk / web-beautify

Format HTML, CSS and JavaScript/JSON by js-beautify
GNU General Public License v3.0
219 stars 21 forks source link

Unable to open path "/home/user/project/-", "Run `js-beautify` -h for help" #38

Closed stradicat closed 5 years ago

stradicat commented 5 years ago

Whenever I run web-beautify-js on a file, say /home/user/project/file.js, I get the following error message:

Unable to open path "/home/user/project/-"
Run `js-beautify -h` for help.

Why is a - replacing the actual file.js file name? It remember having used web-beautify-js last year without problems.

This happens at least in Emacs 26.1, both plain and with Spacemacs 0.200.13. Added web-beautify and js2-mode from MELPA, nothing else.

(Currently using js-beautify version 1.8.9)

jvargas commented 5 years ago

This can be fixed by changing the web-beatutify-args variable to: (defconst web-beautify-args '("-"))

The problem is with (js-beautify version 1.8.9) which is not respecting the contract. js-beautify -f - fails with error:

Unable to open path "$HOME/-"
Run `js-beautify -h` for help.

Instead js-beautify - works fine.

This is a known issue, see beautify-web/js-beautify#1609

stradicat commented 5 years ago

Confirmed, it works.

Just forked web-beautify, removed the -f from (defconst web-beautify-args '("-")) in web-beautify.el and made a pull request.

dmitry-saritasa commented 5 years ago

Have the same problem on Linux

Unable to open path "/home/wdemo/-"
Run `html-beautify -h` for help.

➜ node --version
v10.15.1
➜ npm --version
6.4.1
➜ js-beautify --version
1.8.9

web-beautify-html is an interactive autoloaded compiled Lisp function in ‘~/Config/.emacs.d/elpa/web-beautify-20161115.2247/web-beautify.el’.

(web-beautify-html)

Format region if active, otherwise the current buffer.

Formatting is done according to the html-beautify command.