const fs = require('fs'); const { execSync } = require('child_process'); try { execSync('node -c index.js', { stdio: 'pipe' }); console.log("No syntax errors found."); } catch (err) { console.log(err.stderr.toString()); }