Closed Yberion closed 1 year ago
I believe nx is currently not able to work with prettier 3, and thus why it breaks
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)
Hello, it should properly work as of 16.8.0-beta.0.
Upgraded to 16.8.0-beta.2. Still have it
Fails to me as well, latest nrwl and nx and prettier!
likewise
nx/*: 16.8.0-beta.3,
@swc-node/register: ^1.6.7,
@swc/core: ^1.3.80,
TypeError: Invalid host defined options
at Object.<anonymous> (/Users/cereum/cfx/cfx-b2b-services/node_modules/.pnpm/prettier@3.0.2/node_modules/prettier/index.cjs:600:23)
at Module._compile (/Users/cereum/cfx/cfx-b2b-services/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 (/Users/cereum/cfx/cfx-b2b-services/node_modules/.pnpm/nx@16.8.0-beta.3_@swc-node+register@1.6.7_@swc+core@1.3.80/node_modules/nx/bin/init-local.js:203:36)
at require (/Users/cereum/cfx/cfx-b2b-services/node_modules/.pnpm/v8-compile-cache@2.3.0/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
at Object.<anonymous> (/Users/cereum/cfx/cfx-b2b-services/node_modules/.pnpm/nx@16.8.0-beta.3_@swc-node+register@1.6.7_@swc+core@1.3.80/node_modules/nx/src/command-line/format/format.js:11:18)
at Module._compile (/Users/cereum/cfx/cfx-b2b-services/node_modules/.pnpm/v8-compile-cache@2.3.0/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
Node.js v20.5.1
you can set DISABLE_V8_COMPILE_CACHE
environment variable before execute command
DISABLE_V8_COMPILE_CACHE=1 nx format:write
This is not fixed in Nx 16.8.1
yarn nx report
> NX Report complete - copy this into the issue template
Node : 18.12.1
OS : darwin-arm64
yarn : 3.5.1
nx : 16.8.1
@nx/workspace : 16.8.1
@nx/devkit : 16.8.1
@nrwl/tao : 16.8.1
nx-cloud : 16.4.0
typescript : 4.9.5
Error
yarn nx format:check
/Users/ian/code/newsletter/node_modules/prettier/index.cjs:600
var prettierPromise = import("./index.mjs");
^
TypeError: Invalid host defined options
at Object.<anonymous> (/Users/ian/code/newsletter/node_modules/prettier/index.cjs:600:23)
at Module._compile (/Users/ian/code/newsletter/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
at Module.load (node:internal/modules/cjs/loader:1037:32)
at Module._load (node:internal/modules/cjs/loader:878:12)
at Module.require (node:internal/modules/cjs/loader:1061:19)
at Mod.require (/Users/ian/code/newsletter/node_modules/nx/bin/init-local.js:203:36)
at require (/Users/ian/code/newsletter/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
at Object.<anonymous> (/Users/ian/code/newsletter/node_modules/nx/src/command-line/format/format.js:10:18)
at Module._compile (/Users/ian/code/newsletter/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
Node.js v18.12.1
Prettier and related dependencies:
"prettier": "^3.0.3",
"eslint-plugin-prettier": "^5.0.0",
"eslint-config-prettier": "^9.0.0",
"@trivago/prettier-plugin-sort-imports": "^4.2.0",
"eslint": "^8.44.0",
same error
This PR hasn't been released yet, so you'll still get the error. https://github.com/nrwl/nx/pull/19075
thanks fixed in version 16.9
Really? I am still seeing the error in 16.10.0
... Any other potential tricks to fix this one?
What command are you running that leads to you hitting the errror?
@AgentEnder Just trying to spin up a new @nx/js
lib.
nx g @nx/js:lib types --directory libs/types --bundler rollup
Until it is fixed, I have simply downgraded from prettier to version 2.8.8 and it has worked for me:
"devDependencies": {
...
"prettier": "2.8.8",
...
},
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.
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-lockfile
pnpm run format
Nx Report
Failure Logs
Operating System
Additional Information
No response