Downloading images (curl) is not the right way for Linux?

I have a lot of images and there is a function that takes an array of links in each element and runs them through a function to download them and returns links to them, which I then save to the database. This works on windows, but doesn’t work on linux. The folder has write rights, I transfer files there manually via ssh without any problems and can download the image by running curl in the console without any problems.

cd /var/www/html/static && curl -O https:/imgurl.com/uploads/catalog/i/lbig/963949fdf7.jpg --parallel

But when the script runs, it creates subfolders, but there is nothing in them. I think the problem is with the paths

I made test scripts with different options, the first two create folders but again there is nothing in them.

The problem is definitely on the way, because… curl in console downloads everything correctly and the folder has permissions for everything

Help me choose the best path so that it works correctly in Linux and node.js

shell.cd('./static/images')
if (shell.ls('./').includes('objects')) {
    shell.rm('-rf', './objects')
}
shell.mkdir('objects')


async function downloadAndSaveImages(cleanLinks, folderPath) {
    const arr = []
    try {
        await fs.mkdir(folderPath, { recursive: true });
        shell.cd(folderPath)
        let command = `cd ${folderPath} && curl `
            + Array(cleanLinks.length).fill('-O').join(' ')
            + ' '
            + Array(cleanLinks.length).fill(null).map((_, i) => {
                return cleanLinks[i].split('?')[0]
            }).join(' ')
            + ' --parallel'

        for (let i = 0; i < cleanLinks.length; i++) {
            const imageUrl = cleanLinks[i].replace(/?.*/, '');
            const imageFileName = path.basename(imageUrl);
            const imagePath = path.join(folderPath, imageFileName);
            arr.push(imagePath.replace(/.*?static/, '/static').replace(/\/g, '/'))
        }
        await execPromise(command, { timeout: 5000 })
        await Promise.allSettled(command)
        return arr;
    } catch (error) {
        return arr
    }
}

async function start() {

    const photoFolderPath = path.join(__dirname, '..', 'static', 'test', '9639497');
    const cleanLinksNew = await downloadAndSaveImages(['https:/imgurl.com/uploads/catalog/i/lbig/963949fdf7.jpg'], photoFolderPath);

    const photoFolderPath2 = path.resolve(__dirname, '../static/test1', '9639497');
    const cleanLinksNew2 = await downloadAndSaveImages(['https:/imgurl.com/uploads/catalog/i/lbig/963949fdf7.jpg'], photoFolderPath2);

    const photoFolderPath3 = path.join('/var/www/html/static', 'test2', '9639497');
    const cleanLinksNew3 = await downloadAndSaveImages(['https:/imgurl.com/uploads/catalog/i/lbig/963949fdf7.jpg'], photoFolderPath3);

    const photoFolderPath4 = path.resolve('/var/www/html/static/test3', '9639497');
    const cleanLinksNew4 = await downloadAndSaveImages(['https:/imgurl.com/uploads/catalog/i/lbig/963949fdf7.jpg'], photoFolderPath4);

    const photoFolderPath5 = path.join('/var', 'www', 'html', 'static', 'test4', '9639497');
    const cleanLinksNew5 = await downloadAndSaveImages(['https:/imgurl.com/uploads/catalog/i/lbig/963949fdf7.jpg'], photoFolderPath5);

    const photoFolderPath6 = path.join('/var', 'www', 'html', 'static', 'test5', '9639497');
    const cleanLinksNew6 = await downloadAndSaveImages(['https:/imgurl.com/uploads/catalog/i/lbig/963949fdf7.jpg'], photoFolderPath6);

    const photoFolderPath7 = path.join( 'static', 'test6', '9639497');
    const cleanLinksNew7 = await downloadAndSaveImages(['https:/imgurl.com/uploads/catalog/i/lbig/963949fdf7.jpg'], photoFolderPath7);

}

start()

enter image description here