You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I run nodejs scripts using @nx/js:node
When there's a TS compilation or runtime error - I don't see it, tasks exits without any error output.
This makes debugging a nightmare.
Expected Behavior
I can see stderr when using @nx/js:node
GitHub Repo
No response
Steps to Reproduce
Add console.log("test".replaceAll(/a/, "b")); to your script
Temporary fix is to add console.error(data.toString()); into node_modules\@nx\js\src\executors\node\node.impl.js:
// Run the programtask.promise=newPromise((resolve,reject)=>{var_a;task.childProcess=(0,child_process_1.fork)((0,devkit_1.joinPathFragments)(__dirname,'node-with-require-overrides'),(_a=options.runtimeArgs)!==null&&_a!==void0 ? _a : [],{execArgv: getExecArgv(options),stdio: [0,1,'pipe','ipc'],env: Object.assign(Object.assign({},process.env),{NX_FILE_TO_RUN: fileToRun,NX_MAPPINGS: JSON.stringify(mappings)}),});task.childProcess.stderr.on('data',(data)=>{console.error(data.toString());// Don't log out error if task is killed and new one has started.// This could happen if a new build is triggered while new process is starting, since the operation is not atomic.if(options.watch&&!task.killed){devkit_1.logger.error(data.toString());}});task.childProcess.once('exit',(code)=>{if(options.watch&&!task.killed){devkit_1.logger.info(`NX Process exited with code ${code}, waiting for changes to restart...`);}if(!options.watch)done();resolve();});next({success: true});});
The text was updated successfully, but these errors were encountered:
@mandarini thanks for addressing this! There was another related issue I forgot to mention - using npm's debug package, it uses process.stderr.write under the hood, and nx run was "swallowing" all stderr. I assume that your fix addressed this, but I thought I'd mention it here just in case.
Current Behavior
I run nodejs scripts using
@nx/js:node
When there's a TS compilation or runtime error - I don't see it, tasks exits without any error output.
This makes debugging a nightmare.
Expected Behavior
I can see stderr when using @nx/js:node
GitHub Repo
No response
Steps to Reproduce
console.log("test".replaceAll(/a/, "b"));
to your script@nx/js:node
Nx Report
Failure Logs
No response
Operating System
Additional Information
This seems related to #17083
Temporary fix is to add
console.error(data.toString());
intonode_modules\@nx\js\src\executors\node\node.impl.js
:The text was updated successfully, but these errors were encountered: