Cannot find module './parser-typescript.js' when running prettierd
benjypng opened this issue · 3 comments
Encountered the below error when running prettierd. Tried to Google but couldn't find anyone else who had the same issue.
Error: Cannot find module './parser-typescript.js'
Require stack:
- /opt/homebrew/Cellar/prettierd/0.22.3/libexec/lib/node_modules/@fsouza/prettierd/node_modules/prettier/index.js
- /opt/homebrew/Cellar/prettierd/0.22.3/libexec/lib/node_modules/@fsouza/prettierd/dist/service.js
- /opt/homebrew/Cellar/prettierd/0.22.3/libexec/lib/node_modules/@fsouza/prettierd/node_modules/core_d/lib/server.js
- /opt/homebrew/Cellar/prettierd/0.22.3/libexec/lib/node_modules/@fsouza/prettierd/node_modules/core_d/lib/daemon.js
Trying my luck here to see if there is a resolution? Am only encountering this issue when trying to format typescript or tsx files.
Edit:
I realise that after upgrading to 0.22.4, prettierd is still looking for 0.22.3. I have done a brew link --overwrite prettierd
after renaming 0.22.4 to 0.22.3 and it works. But I am sure there is a cleaner and more proper way to do this?
Yeah, prettierd doesn't ship with the typescript parser. In npm packages folks can add it and it works, but I guess with brew things are a bit trickier 🤔
To be honest, in 2022 typescript is standard enough that we should ship with it, but we may run into similar limitation with other parsers.
I'll make the change to add typescript as a dependency and then we can figure out whether there's a better strategy for extra parsers with homebrew.