permission – How to capture an audio from microphone using node.js?

I have a problem with macos restrictions. I need to capture an audio from the microphone using node.js but it looks that macos just aborts my command:

ffmpeg -f avfoundation -i ":1" -t 3600 audiocapture.mp3

However this command successfully works in terminal but not in node.js:

const child_process = require("child_process");
child = child_process.spawn("ffmpeg", ( "-f avfoundation", "-i ':1'", "-t 300", "file.wav" ));

Macos just aborts such process. How to solve this problem?