When I try to run >Format Document inside VCCode on .astro file I get this error:
Error [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import '/Users/adam.klepacz/Documents/projects/sds/mywow/node_modules/prettier-plugin-astro' is not supported resolving ES modules imported from /Users/adam.klepacz/Documents/projects/node_modules/prettier/index.mjs
Did you mean to import /Users/adam.klepacz/Documents/projects/sds/mywow/node_modules/prettier-plugin-astro/dist/index.js?
at new NodeError (node:internal/errors:387:5)
at finalizeResolution (node:internal/modules/esm/resolve:425:17)
at moduleResolve (node:internal/modules/esm/resolve:1012:10)
at defaultResolve (node:internal/modules/esm/resolve:1220:11)
at nextResolve (node:internal/modules/esm/loader:165:28)
at ESMLoader.resolve (node:internal/modules/esm/loader:844:30)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:431:18)
at ESMLoader.import (node:internal/modules/esm/loader:528:22)
at importModuleDynamically (node:internal/modules/esm/translators:110:35)
at importModuleDynamicallyCallback (node:internal/process/esm_loader:35:14) {
code: 'ERR_UNSUPPORTED_DIR_IMPORT',
url: 'file:///Users/adam.klepacz/Documents/projects/sds/mywow/node_modules/prettier-plugin-astro'
}
Here is what I see in node_modules after installing my project
Anytime I try to run vscode command >Format Document on .astro file I got this error in Astro language server Output tab
Error [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import '/Users/adam.klepacz/Documents/projects/sds/mywow/node_modules/prettier-plugin-astro' is not supported resolving ES modules imported from /Users/adam.klepacz/Documents/projects/node_modules/prettier/index.mjs
Did you mean to import /Users/adam.klepacz/Documents/projects/sds/mywow/node_modules/prettier-plugin-astro/dist/index.js?
at new NodeError (node:internal/errors:387:5)
at finalizeResolution (node:internal/modules/esm/resolve:425:17)
at moduleResolve (node:internal/modules/esm/resolve:1012:10)
at defaultResolve (node:internal/modules/esm/resolve:1220:11)
at nextResolve (node:internal/modules/esm/loader:165:28)
at ESMLoader.resolve (node:internal/modules/esm/loader:844:30)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:431:18)
at ESMLoader.import (node:internal/modules/esm/loader:528:22)
at importModuleDynamically (node:internal/modules/esm/translators:110:35)
at importModuleDynamicallyCallback (node:internal/process/esm_loader:35:14) {
code: 'ERR_UNSUPPORTED_DIR_IMPORT',
url: 'file:///Users/adam.klepacz/Documents/projects/sds/mywow/node_modules/prettier-plugin-astro'
}
Steps to Reproduce
npm init astro using template
...
...
...
Error! Describe what went wrong (and what was expected instead)...
Describe the Bug
When I try to run >Format Document inside VCCode on .astro file I get this error:
Node version is 18.12.14 npm version 8.19.2
Here is my package.json
here is my .prettierrc file
I also tried with this .prettierrc file where I manually defined the plugin itselft. Also didn't work.
Here is what I see in node_modules after installing my project
Anytime I try to run vscode command >Format Document on .astro file I got this error in Astro language server Output tab
Steps to Reproduce
npm init astro
using template