nx: 🐞 bug: prettier 3 error `Invalid host defined options`
Current Behavior
When trying to format the code with prettier 3, I’m getting an error (check log below).
I’m not sure if it’s related to nx or another package (prettier itselft probably), I found this issue https://github.com/prettier/prettier/issues/15098 & https://github.com/prettier/prettier-vscode/issues/3114 and I’m not able to reproduce on nx-examples or another Angular project (using nx as well).
Expected Behavior
Formatting without errors.
GitHub Repo
https://github.com/Yberion/image-utils/tree/feature/prettier3
Steps to Reproduce
pnpm install --no-frozen-lockfilepnpm run format
Nx Report
> NX Falling back to ts-node for local typescript execution. This may be a little slower.
- To fix this, ensure @swc-node/register and @swc/core have been installed
> NX Report complete - copy this into the issue template
Node : 20.5.0
OS : win32-x64
pnpm : 8.6.12
nx : 16.8.0-beta.0
@nx/js : 16.8.0-beta.0
@nx/linter : 16.8.0-beta.0
@nx/workspace : 16.8.0-beta.0
@nx/devkit : 16.8.0-beta.0
@nx/esbuild : 16.8.0-beta.0
@nx/eslint-plugin : 16.8.0-beta.0
@nrwl/tao : 16.8.0-beta.0
@nx/vite : 16.8.0-beta.0
typescript : 5.1.6
Failure Logs
E:\Git\myberion\image-utils\node_modules\.pnpm\prettier@3.0.2\node_modules\prettier\index.cjs:600
var prettierPromise = import("./index.mjs");
^
TypeError: Invalid host defined options
at Object.<anonymous> (E:\Git\myberion\image-utils\node_modules\.pnpm\prettier@3.0.2\node_modules\prettier\index.cjs:600:23)
at Module._compile (E:\Git\myberion\image-utils\node_modules\.pnpm\v8-compile-cache@2.3.0\node_modules\v8-compile-cache\v8-compile-cache.js:192:30)
at Module._extensions..js (node:internal/modules/cjs/loader:1287:10)
at Module.load (node:internal/modules/cjs/loader:1091:32)
at Module._load (node:internal/modules/cjs/loader:938:12)
at Module.require (node:internal/modules/cjs/loader:1115:19)
at Mod.require (E:\Git\myberion\image-utils\node_modules\.pnpm\nx@16.8.0-beta.0\node_modules\nx\bin\init-local.js:203:36)
at require (E:\Git\myberion\image-utils\node_modules\.pnpm\v8-compile-cache@2.3.0\node_modules\v8-compile-cache\v8-compile-cache.js:159:20)
at Object.<anonymous> (E:\Git\myberion\image-utils\node_modules\.pnpm\nx@16.8.0-beta.0\node_modules\nx\src\command-line\format\format.js:10:18)
at Module._compile (E:\Git\myberion\image-utils\node_modules\.pnpm\v8-compile-cache@2.3.0\node_modules\v8-compile-cache\v8-compile-cache.js:192:30)
Node.js v20.5.0
ELIFECYCLE Command failed with exit code 1.
Operating System
- macOS
- Linux
- Windows
- Other (Please specify)
Additional Information
No response
About this issue
- Original URL
- State: closed
- Created 10 months ago
- Reactions: 5
- Comments: 15 (5 by maintainers)
you can set
DISABLE_V8_COMPILE_CACHEenvironment variable before execute commandlikewise
This is not fixed in Nx 16.8.1
Error
Prettier and related dependencies:
thanks fixed in version 16.9
This PR hasn’t been released yet, so you’ll still get the error. https://github.com/nrwl/nx/pull/19075
Hello, it should properly work as of 16.8.0-beta.0.
(edit: I was replying to @FaresKi, I’m still facing the problem on latest version of nx)