I'm trying to un-minimify JS code on Windows. I've installed web-beautify from MELPA. I also installed Node.js for Windows, which is a dependency of this package. I then ran npm -g install js-beautify as instructed. The command completed well. Howevever, calling web-beautify-js on a js buffer still does not work.

The program js-beautify works on my command-line tools, but not in my Emacs Shells, even though the variables (PATH and exec-path) are well set. I suspect this comes from the fact that js-beautify is in fact a Batch script which calls the program node, with an argument. I don't know why, but the batch script does not work from an emacs shell - except if I call it from its directory

It is possible though to reproduce the behaviour of the script in an Emacs Shell anywhere. For instance, although typing js-beautify does not work, the following command worked:

node <path-to-npm>\node_modules\js-beautify\js\bin\js-beautify.js <file>

However, I have no idea how to go any further. What I want is not to be able to call js-beautify from an Emacs shell, but to be able to call web-beautify-js from any js buffer. Has anyone found a clean hack to do this?

(Error message on web-beautify-js:

'js-beautify' is not recognized as an internal or external command, operable program or batch file.


  • An "emacs shell" is M-x shell?
    – JeanPierre
    Jun 26, 2019 at 10:58
  • Yes, either M-x shell or M-x eshell, both have the same behaviour on this issue.
    – kotchwane
    Jun 26, 2019 at 11:35


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.