child_process.exec 在路径中找不到 cmd
child_process.exec not finding cmd in path
所以我安装了 ffmpeg 并将其添加到我的路径中。
如果我运行ffmpeg
在cmd.exe,它运行sffmpeg.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);
}
});
});
重新启动后 Visual Studio 代码再次运行。奇怪。
所以我安装了 ffmpeg 并将其添加到我的路径中。
如果我运行ffmpeg
在cmd.exe,它运行sffmpeg.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);
}
});
});
重新启动后 Visual Studio 代码再次运行。奇怪。