FFMPEG node.js using with ytdl

I have nodejs javascript code and I want that the video and the audio is downloaded, to combine it with ffmpeg. First, the video is longer that it should be, idk why. Second, the ffmpeg is not working because I’m getting an error, that ffmpeg can’t find (but I installed fluent-ffmpeg via npm correctly)

My code:

const fs = require('fs');
const ytdl = require('ytdl-core');
const ffmpeg = require('fluent-ffmpeg');



// Function to download the youtube video
function download() {
    const linkInput = document.getElementById('linkInp');
    const resolution = document.getElementById('resolution');
    const videoTitle = document.getElementById('videoTitle');
    const videoAuthor = document.getElementById('videoAuthor');
    const videoUploadDate = document.getElementById('videoUploadDate');
    const videoPicture = document.getElementById('videoPic');
    const link = linkInput.value;
    console.log('Downloading following video from link: ', link, ' with resolution id: ', resolution.value);

    ytdl.getInfo(link).then((info) => {
        const format = ytdl.chooseFormat(info.formats, { quality: `${resolution.value}` });
        const videoFilePath = `${info.videoDetails.title}.${format.container}`;
        const audioFilePath = `${info.videoDetails.title}.mp3`;

        // before download, collect meta datas
        videoTitle.innerHTML = info.videoDetails.title;
        videoAuthor.innerHTML = info.videoDetails.author.name;
        videoUploadDate.innerHTML = info.videoDetails.uploadDate;
        videoPicture.src = info.videoDetails.thumbnails[0].url;

        // start downloading the video
        ytdl.downloadFromInfo(info, { format: format }).pipe(fs.createWriteStream(videoFilePath));

        // download audio separately
        ytdl.downloadFromInfo(info, { filter: 'audioonly' }).pipe(fs.createWriteStream(audioFilePath)).on('finish', () => {
            // merge video and audio after both are downloaded
            ffmpeg()
                .input(videoFilePath)
                .input(audioFilePath)
                .videoCodec('copy')
                .audioCodec('copy')
                .save(`${info.videoDetails.title}_with_audio.${format.container}`)
                .on('end', () => {
                    console.log('Video with audio merged successfully!');
                    fs.unlink(videoFilePath, (err) => {
                        if (err) console.error(err);
                    });
                    fs.unlink(audioFilePath, (err) => {
                        if (err) console.error(err);
                    });
                });
        });

    }).catch((err) => {
        console.error(err);
        document.getElementById('msg').style.display = 'block';
        document.getElementById('message').innerHTML = err;
    });
}

Thanks for every help!