-
Notifications
You must be signed in to change notification settings - Fork 2.6k
fix(js): resolve nx binary from workspace root in node executor #33842
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
✅ Deploy Preview for nx-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
View your CI Pipeline Execution ↗ for commit 25a24d0
☁️ Nx Cloud last updated this comment at |
When running `nx serve` with a NestJS project (and other node apps using
`runBuildTargetDependencies`), the node executor attempts to resolve the `nx`
binary using `require.resolve('nx')`. This fails with pnpm because:
1. `nx` is only a `devDependency` of `@nx/js`, not a regular `dependency`
2. pnpm's strict isolation prevents packages from resolving dependencies not
declared in their package.json
3. The `nx` package doesn't have a `main` field, only `bin`, so
`require.resolve('nx')` fails
This results in `Error: Cannot find module 'nx'` when trying to serve a
NestJS application.
The node executor should correctly resolve and use the `nx` binary from the
workspace where it's always installed.
Fixes #33776
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <[email protected]>
## Current Behavior
When running `nx serve` with a NestJS project (and other node apps using
`runBuildTargetDependencies`), the node executor attempts to resolve the
`nx` binary using `require.resolve('nx')`. This fails with because
`nx/package.json` does no longer has a `main` field.
## Expected Behavior
The node executor should correctly resolve and use the `nx` binary from
the workspace where it's always installed.
This is fixed by using `nx/bin/nx.js` instead of just `nx` -- as we do
in other places.
## Related Issue(s)
Fixes #33776
Co-authored-by: Claude Opus 4.5 <[email protected]>
(cherry picked from commit 192099a)
## Current Behavior
When running `nx serve` with a NestJS project (and other node apps using
`runBuildTargetDependencies`), the node executor attempts to resolve the
`nx` binary using `require.resolve('nx')`. This fails with because
`nx/package.json` does no longer has a `main` field.
## Expected Behavior
The node executor should correctly resolve and use the `nx` binary from
the workspace where it's always installed.
This is fixed by using `nx/bin/nx.js` instead of just `nx` -- as we do
in other places.
## Related Issue(s)
Fixes #33776
Co-authored-by: Claude Opus 4.5 <[email protected]>
|
This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request. |
Current Behavior
When running
nx servewith a NestJS project (and other node apps usingrunBuildTargetDependencies), the node executor attempts to resolve thenxbinary usingrequire.resolve('nx'). This fails with becausenx/package.jsondoes no longer has amainfield.Expected Behavior
The node executor should correctly resolve and use the
nxbinary from the workspace where it's always installed.This is fixed by using
nx/bin/nx.jsinstead of justnx-- as we do in other places.Related Issue(s)
Fixes #33776