How to give NodeJS scripts admin privileges ?

Felon's icon

Felon

6月 25 2024 | 8:55 午前

Hello team,

I have an issue on a new Windows computer that I am setting up for a patch that works perfectly on another machine. When I try to use some basic NodeJS communication with the PC (through child- process), I have an error message sayin' that the script (or the program ?) doesn't have the right access: it lacks privileges.

An example with simple function :

//--------------------------------- PING ------------------------------------
maxApi.addHandler('ping_out', function() //
{
var exec = require('child_process').exec;
exec("ping -c 1 localhost", function(err, stdout, stderr) {
console.log(stdout);
maxApi.post(stdout);
})
});
//------------------------------------------------------------------------------

The node.js debug tool says (in french) => "Access Denied, option -c requires admin privileges". 


I installed everything like before, with normal Max settings. I didn't encounter this issue with other computers.

Sorry if it's a really simple thing to solve, but maybe other users will have to deal with that.

Thank you !!!