nx icon indicating copy to clipboard operation
nx copied to clipboard

Can't use Nextra with Nx -- based on #22515

Open jonasschultheiss opened this issue 1 year ago • 1 comments

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?

jonasschultheiss avatar Oct 17 '24 11:10 jonasschultheiss

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?

ndcunningham avatar Oct 18 '24 18:10 ndcunningham

Sure, here's my poc I'm currrently working on. Please see the repro/nx-next branch.

  1. run pnpm build:docs --verbose or open nx.json with vscode and take a look at the error.
  2. run mv pagess pages
  3. run nx reset
  4. run pnpm build:docs --verbose again

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

jonasschultheiss avatar Oct 24 '24 13:10 jonasschultheiss

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! 🙏

github-actions[bot] avatar Nov 01 '24 00:11 github-actions[bot]

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.

jonasschultheiss avatar Nov 01 '24 08:11 jonasschultheiss

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! 🙏

github-actions[bot] avatar Nov 10 '24 00:11 github-actions[bot]

i added a repro

jonasschultheiss avatar Nov 10 '24 09:11 jonasschultheiss

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! 🙏

github-actions[bot] avatar Nov 18 '24 00:11 github-actions[bot]

@ndcunningham i've provided a repro

jonasschultheiss avatar Nov 18 '24 09:11 jonasschultheiss

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! 🙏

github-actions[bot] avatar Nov 26 '24 00:11 github-actions[bot]

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 the next.config.mjs
  • mv pagess pages - Will not work since there is no folder named pagess at the root dir

ndcunningham avatar Nov 27 '24 17:11 ndcunningham

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! 🙏

github-actions[bot] avatar Dec 05 '24 00:12 github-actions[bot]

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.

github-actions[bot] avatar Jan 27 '25 00:01 github-actions[bot]