Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Node.js warnings on startup from pre-compiled binaries #762

Closed
mountaindude opened this issue Mar 22, 2024 · 1 comment · Fixed by #776 or #774 · May be fixed by #779
Closed

Remove Node.js warnings on startup from pre-compiled binaries #762

mountaindude opened this issue Mar 22, 2024 · 1 comment · Fixed by #776 or #774 · May be fixed by #779

Comments

@mountaindude
Copy link
Collaborator

Pass in --options no-deprecation to pkg when building binaries.

@mountaindude
Copy link
Collaborator Author

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);
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant