Open FabianKoder opened 5 months ago
@ndcunningham @FrozenPandaz any progress on this? Generators can't be used in NX anymore, which I'd say is quite critical. Is it being worked on?
Also, this shouldn't be just scope: nextjs
. It happens for Node as well, and various other generators.
This broke an internal plugin which started using the project crystal stuff as the code examples showed using projectGraphCacheDirectory to cache the results.
Hi I am using nx version 18.3.3 and have some custom generators. Some of them are using the nx react generators and add few things on top. Currently I get the same error as described here in this issue. When I run with verbose I get:
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
at new NodeError (node:internal/errors:405:5)
at validateString (node:internal/validators:162:11)
at join (node:path:429:7)
at Object.<anonymous> (C:\Users\lkrue\AppData\Local\Temp\tmp-35980-mLe4OtkhkdUF\node_modules\.pnpm\@nx+vite@18.3.3_@types+node@20.14.9_nx@19.3.2_typescript@5.5.2_vite@5.3.2_vitest@1.6.0\node_modules\@nx\vite\src\plugins\plugin.js:24:34)
at Module._compile (node:internal/modules/cjs/loader:1256:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Module._load (node:internal/modules/cjs/loader:960:12)
at Module.require (node:internal/modules/cjs/loader:1143:19)
at Mod.require (C:\Users\lkrue\develop\projects\BJB\itdev-348-latest-4\node_modules\.pnpm\nx@18.3.3\node_modules\nx\bin\init-local.js:157:36)
When the user chooses vite as bundler, nx seems to bring in stuff from 19.3.2 (latest) which causes the error.
See this line from the error above:
at Object.<anonymous> (C:\Users\lkrue\AppData\Local\Temp\tmp-35980-mLe4OtkhkdUF\node_modules\.pnpm\@nx+vite@18.3.3_@types+node@20.14.9_nx@19.3.2_typescript@5.5.2_vite@5.3.2_vitest@1.6.0\node_modules\@nx\vite\src\plugins\plugin.js:24:34)
If I put an explicit dependency to @nx/vite 18.3.3 in the package.json before running my generator it uses the correct version and works fine.
I'd love to know what should I do actually being stopped by this - use older version? which one?
I am approaching nx probably fourth time during last two years and always struggling with errors like this...
All of our internal generator broke after migrating to v19 or v20. This is a huge blocker that is keeping us on v18 for quite some time.
Current Behavior
I tried generating a new application in a completely fresh, empty NX workspace and all generators (including @nx/next) I tried out failed with the error
The "path" argument must be of type string. Received undefined
.Example:
nx g @nx/next:app sample-name
.After checking the stacktrace I narrowed it down, in both cases, to the jest plugin (@nx/jest) even though the other generator is not even using it. It tries reading
projectGraphCacheDirectory
which was removed in this PR https://github.com/nrwl/nx/pull/23381 / commit https://github.com/nrwl/nx/commit/5e39cb00194f01a17c007c101452e47a91b547db released with 19.2.0. The "fix" is probably to not make a breaking change in a minor version bump and re-addprojectGraphCacheDirectory
that just exactly exports the same thing asworkspaceDataDirectory
, since this not only breaks generators/plugins in control of nx like the jest plugin, but also potentially all other generators reading theprojectGraphCacheDirectory
.Expected Behavior
Re-add
projectGraphCacheDirectory
and probably update the jest plugin to use the new export name so nx can be used again as intended.GitHub Repo
No response
Steps to Reproduce
nx g @nx/next:app sample-name
Nx Report
Failure Logs
Package Manager Version
No response
Operating System
Additional Information
No response