`nx run api:serve` not working on project folder
diegoholiveira opened this issue · 1 comments
diegoholiveira commented
Current Behavior
Trying to serve my app directly from the project folder, I got this error:
~/projects/prospera-nx/packages/apps/api % nx run api:serve
> nx run api:serve:development
✘ [ERROR] Cannot find tsconfig file "packages/apps/api/tsconfig.app.json"
✘ [ERROR] Invalid config file due to following: No inputs were found in config file 'tsconfig.json'. Specified 'include' paths were '["**/*"]' and 'exclude' paths were '[]'. [plugin nx-watch-plugin]
Expected Behavior
I expect the same behavior of running this command from the repository root:
~/projects/prospera-nx % nx run api:serve
> nx run api:serve:development
[ watch ] build succeeded, watching for changes...
Debugger listening on ws://localhost:9229/bdcd7a57-cb5b-47ab-afb4-de7ef7fde472
Debugger listening on ws://localhost:9229/bdcd7a57-cb5b-47ab-afb4-de7ef7fde472
For help, see: https://nodejs.org/en/docs/inspector
{"level":30,"time":1715641490073,"pid":6364,"hostname":"Diegos-MacBook-Pro.local","msg":"Server listening at http://[::1]:3000"}
{"level":30,"time":1715641490073,"pid":6364,"hostname":"Diegos-MacBook-Pro.local","msg":"Server listening at http://127.0.0.1:3000"}
[ ready ] http://localhost:3000
GitHub Repo
No response
Steps to Reproduce
This project is brand new, I just executed those commands:
npx create-nx-workspace@latest
nx add @nx/node
nx add @nx/next
nx g @nx/next:app web --directory=packages/apps/web
nx g @nx/node:application api --directory=packages/apps/api --framework=fastify --frontendProject=web
Nx Report
NX Report complete - copy this into the issue template
Node : 20.13.1
OS : darwin-arm64
pnpm : 9.1.1
nx : 19.0.3
@nx/js : 19.0.3
@nx/jest : 19.0.3
@nx/linter : 19.0.3
@nx/eslint : 19.0.3
@nx/workspace : 19.0.3
@nx/devkit : 19.0.3
@nx/esbuild : 19.0.3
@nx/eslint-plugin : 19.0.3
@nx/next : 19.0.3
@nx/node : 19.0.3
@nx/react : 19.0.3
@nrwl/tao : 19.0.3
@nx/web : 19.0.3
@nx/webpack : 19.0.3
typescript : 5.4.5
---------------------------------------
Registered Plugins:
@nx/next/plugin
@nx/eslint/plugin
@nx/jest/plugin
### Failure Logs
_No response_
### Package Manager Version
9.1.1
### Operating System
- [X] macOS
- [ ] Linux
- [ ] Windows
- [ ] Other (Please specify)
### Additional Information
_No response_
ndcunningham commented
By default nx generator commands cwd
are at the workspace level.
If you are changing that to a project you need to alter the project.json
that points to files which are used by the said executor.
In your case you need to update the build executor from being workspace level to be relative to your project
For example
"tsConfig": "apps/nrwl/tsconfig.app.json",
should now be changed to
"tsConfig": "tsconfig.app.json",