'How to make Prettier plugin work in PhpStorm?

I installed the Prettier plugin, installed Prettier with npm into my project, and when I try to use it to reformat something, it acts like there's a bug in Prettier. Here's what I get.

<...>node_modules\prettier\index.js:12947
    } catch {
            ^

SyntaxError: Unexpected token {
    at new Script (vm.js:51:7)
    at createScript (vm.js:136:10)
    at Object.runInThisContext (vm.js:197:10)
    at Module._compile (module.js:613:28)
    at Object.Module._extensions..js (module.js:660:10)
    at Module.load (module.js:561:32)
    at tryModuleLoad (module.js:501:12)
    at Function.Module._load (module.js:493:3)
    at Module.require (module.js:593:17)
    at require (internal/module.js:11:18)
Process finished with exit code -1

Any ideas?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source