Reputation: 248
I start my app with
yarn nx serve my-api
There is an error in the build of an unknown origin that is being obfuscated by node. The console output says "Use node --trace-warnings ...
to show where the warning was created". How do I run yarn nx serve
in conjunction with --trace-warnings
? I want to get the stack trace so that I can find my error.
Upvotes: 8
Views: 26461
Reputation: 708
node --trace-warnings node_modules/.bin/nx serve my-api
Alternatively, you could include this code within your application:
process.on('warning', e => console.warn(e.stack));
Upvotes: 15
Reputation: 1519
You can add a runtime argument in the project.json as follow:
"serve": {
"executor": "@nx/js:node",
"defaultConfiguration": "development",
"options": {
"watch": false,
"buildTarget": "api-node:build"
},
"configurations": {
"development": {
"buildTarget": "api-node:build:development",
"runtimeArgs": [
"--trace-warnings"
]
},
"production": {
"buildTarget": "api-node:build:production"
}
}
},
Upvotes: 1