Remove Node.js warnings on startup from pre-compiled binaries
mountaindude opened this issue · 1 comments
mountaindude commented
Pass in --options no-deprecation
to pkg when building binaries.
mountaindude commented
Also add to main js file
// Suppress experimental warnings
// https://stackoverflow.com/questions/55778283/how-to-disable-warnings-when-node-is-launched-via-a-global-shell-script
const originalEmit = process.emit;
process.emit = function (name, data, ...args) {
// console.log(`Got a Node.js event: ${name}`);
// console.log(`Type of data: ${typeof data}`);
// if (typeof data === `object`) {
// console.log(`Data: ${JSON.stringify(data)}`);
// console.log(`Data name: ${data.name}`);
// console.log(`Data message: ${data.message}`);
// }
// console.log(`Args: ${args}`);
if (name === `warning` && typeof data === `object` && data.name === `ExperimentalWarning` && data.message.includes(`Fetch API`)) {
return false;
}
return originalEmit.apply(process, arguments);
};