Given an environment consisting of:
$ sw_vers -productVersion
15.3.1 # osx ver
$ node --version
v22.2.0
$ yarn --version
4.7.0
$ yarn dlx prettier --version
3.5.3
And a .prettierrc.js
config file of loading a plugin to parse and format .html.tmpl
files:
/** @type {import("prettier").Options} */
module.exports = {
plugins: [require.resolve("prettier-plugin-go-template")],
};
Executing:
yarn dlx -p prettier-plugin-go-template -p prettier prettier --write content.html.tmpl
Results in the error:
➤ YN0000: · Yarn 4.7.0
➤ YN0000: ┌ Resolution step
➤ YN0085: │ + prettier-plugin-go-template@npm:0.0.15, prettier@npm:3.5.3, ulid@npm:2.3.0
➤ YN0000: └ Completed
➤ YN0000: ┌ Fetch step
➤ YN0013: │ 3 packages were added to the project (+ 7.61 MiB).
➤ YN0000: └ Completed
➤ YN0000: ┌ Link step
➤ YN0000: └ Completed
➤ YN0000: · Done in 0s 121ms
[error] Cannot find module '/Users/me/Projects/myapp/.yarn/__virtual__/prettier-plugin-go-template-virtual-31feb1b637/3/.yarn/berry/cache/prettier-plugin-go-template-npm-0.0.15-9a9f4313e3-10c0.zip/node_modules/prettier-plugin-go-template/lib/index.js'
imported from /private/var/folders/vz/0ch86mrx3b5bphmgqzcx1ynm0000gn/T/xfs-b87ccf64/dlx-20681/.yarn/unplugged/prettier-npm-3.5.3-787132ce04/node_modules/prettier/index.mjs
How do I properly link prettier
with the prettier-plugin-go-template
plugin location within yarn dlx
's virtual environment?