child_process.exec未在路径中找到cmd

问题描述 投票:0回答:1

所以我安装了ffmpeg并将其添加到我的路径中。 如果我在cmd.exe中运行ffmpeg,它将运行ffmpeg.exe。

但是当我使用它时:

const { exec } = require('child_process');

await asyncExec(`ffmpeg -i ${filename}%05d.png ${aviname}`);
//Note: the variables are filled in

我收到此错误:

Command failed: ffmpeg -i thing%05d.png thing.avi
'ffmpeg' is not recognized as an internal or external command,\r\noperable program or batch file.

我不明白为什么会这样开心。我只是在VSCode调试中运行这个应用程序。

编辑:asyncExec是这个函数:

const asyncExec = text => new Promise((res, rej) => {
    exec(text, (err, result) => {
        if (err) {
            rej(err);
        } else {
            res(result);
        }
    });
});
node.js cmd ffmpeg path child-process
1个回答
0
投票

重新启动Visual Studio代码后,它再次工作。奇怪的。

© www.soinside.com 2019 - 2024. All rights reserved.