Can't use Nextra with Nx -- based on #22515
Current Behavior
Adding Nextra to Nx makes it so that Nx is unable to build the dependency graph without the hack described in the original issue (#22515).
Expected Behavior
Be able to migrate my turbo, next, nextra monorepo to Nx.
GitHub Repo
No response
Steps to Reproduce
See the original issue (#22515)
Nx Report
Node : 22.9.0 OS : darwin-arm64 Native Target : aarch64-macos pnpm : 9.12.2
nx (global) : 20.0.1 nx : 20.0.1 @nx/eslint : 20.0.1 @nx/next : 20.0.1 typescript : 5.6.3
Registered Plugins: @nx/next/plugin @nx/eslint/plugin
⚠️ Unable to construct project graph. Failed to process project graph. Run "nx reset" to fix this. Please report the issue if you keep seeing it. Failed to process project graph. Run "nx reset" to fix this. Please report the issue if you keep seeing it.
Failure Logs
An error occurred while processing files for the @nx/next/plugin plugin.
- apps/docs/next.config.mjs: > Couldn't find any `pages` or `app` directory. Please create one under the project root
Error: > Couldn't find any `pages` or `app` directory. Please create one under the project root
at Module.findPagesDir (/Users/jonasschultheiss/project_dir/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/next/dist/lib/find-pages-dir.js:42:15)
at findPagesDirectory (file:///Users/jonasschultheiss/project_dir/node_modules/.pnpm/[email protected]_@[email protected][email protected]_@[email protected][email protected][email protected]_6ne7gbb66ylnuww3p3l6vuytre/node_modules/nextra/dist/server/file-system.js:4:28)
at file:///Users/jonasschultheiss/project_dir/node_modules/.pnpm/[email protected]_@[email protected][email protected]_@[email protected][email protected][email protected]_6ne7gbb66ylnuww3p3l6vuytre/node_modules/nextra/dist/server/file-system.js:10:19
at ModuleJob.run (node:internal/modules/esm/module_job:222:25)
at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)
at async load (/Users/jonasschultheiss/project_dir/node_modules/.pnpm/@[email protected][email protected]/node_modules/@nx/devkit/src/utils/config-utils.js:82:20)
at async loadConfigFile (/Users/jonasschultheiss/project_dir/node_modules/.pnpm/@[email protected][email protected]/node_modules/@nx/devkit/src/utils/config-utils.js:36:22)
at async buildNextTargets (/Users/jonasschultheiss/project_dir/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@[email protected]_@zkochan+js-ya_vldoolhpypydphnr55gp6jdxua/node_modules/@nx/next/src/plugins/plugin.js:53:24)
at async exports.createNodes (/Users/jonasschultheiss/project_dir/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@[email protected]_@zkochan+js-ya_vldoolhpypydphnr55gp6jdxua/node_modules/@nx/next/src/plugins/plugin.js:41:32)
at async /Users/jonasschultheiss/project_dir/node_modules/.pnpm/[email protected]/node_modules/nx/src/project-graph/plugins/utils.js:10:27
Package Manager Version
No response
Operating System
- [ ] macOS
- [ ] Linux
- [ ] Windows
- [ ] Other (Please specify)
Additional Information
The dirty fix works, but is unmaintainable. i dont want a random folder in my monorepo, just because I'm using nextra. A Nx dev responded saying it's fixed, but didn't mention a release, pr or commit -> how is it fixed? is it really?
Hey, thanks for reporting an issue,
I tried to reproduce using the steps you provided in your original issue (https://github.com/nrwl/nx/issues/22515), however, the cwd is set correctly to my project.
Can you create a small repo that I can use to test?
Sure, here's my poc I'm currrently working on. Please see the repro/nx-next branch.
- run
pnpm build:docs --verboseor open nx.json with vscode and take a look at the error. - run
mv pagess pages - run
nx reset - run
pnpm build:docs --verboseagain
I have a complicated setup with the config files as I've experimented with having them stored in an internal package. But I'm 95% sure that that's not related to this problem
This issue has been automatically marked as stale because no reproduction was provided within 7 days. Please help us help you. Providing a repository exhibiting the issue helps us diagnose and fix the issue. Any time that we spend reproducing this issue is time taken away from addressing this issue and other issues. This issue will be closed in 21 days if a reproduction is not provided. If a reproduction has been provided, please reply to keep it active. Thanks for being a part of the Nx community! 🙏
This issue has been automatically marked as stale because no reproduction was provided within 7 days. Please help us help you. Providing a repository exhibiting the issue helps us diagnose and fix the issue. Any time that we spend reproducing this issue is time taken away from addressing this issue and other issues. This issue will be closed in 21 days if a reproduction is not provided. If a reproduction has been provided, please reply to keep it active. Thanks for being a part of the Nx community! 🙏
I've provided a repro as per my last comment.
This issue has been automatically marked as stale because no reproduction was provided within 7 days. Please help us help you. Providing a repository exhibiting the issue helps us diagnose and fix the issue. Any time that we spend reproducing this issue is time taken away from addressing this issue and other issues. This issue will be closed in 21 days if a reproduction is not provided. If a reproduction has been provided, please reply to keep it active. Thanks for being a part of the Nx community! 🙏
i added a repro
This issue has been automatically marked as stale because no reproduction was provided within 7 days. Please help us help you. Providing a repository exhibiting the issue helps us diagnose and fix the issue. Any time that we spend reproducing this issue is time taken away from addressing this issue and other issues. This issue will be closed in 21 days if a reproduction is not provided. If a reproduction has been provided, please reply to keep it active. Thanks for being a part of the Nx community! 🙏
@ndcunningham i've provided a repro
This issue has been automatically marked as stale because no reproduction was provided within 7 days. Please help us help you. Providing a repository exhibiting the issue helps us diagnose and fix the issue. Any time that we spend reproducing this issue is time taken away from addressing this issue and other issues. This issue will be closed in 21 days if a reproduction is not provided. If a reproduction has been provided, please reply to keep it active. Thanks for being a part of the Nx community! 🙏
Hey, I took a look at your repo and steps.
-
pnpm build:docs --verbose- This works without an issue and the cwd reports as the correct path from thenext.config.mjs -
mv pagess pages- Will not work since there is no folder namedpagessat the root dir
This issue has been automatically marked as stale because no reproduction was provided within 7 days. Please help us help you. Providing a repository exhibiting the issue helps us diagnose and fix the issue. Any time that we spend reproducing this issue is time taken away from addressing this issue and other issues. This issue will be closed in 21 days if a reproduction is not provided. If a reproduction has been provided, please reply to keep it active. Thanks for being a part of the Nx community! 🙏
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.