最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

node.js - yarn dlx + prettier cli + plugin: format golang .html.tmpl files - Stack Overflow

programmeradmin2浏览0评论

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?

发布评论

评论列表(0)

  1. 暂无评论