我正在在线文件资源管理器上构建一个项目,每当我尝试将应用程序启动到本地主机时,它都会说"du command not recognised"


const {execSync} = require('child_process');
try{
const result = execSync(`du -sh "UsershitesDownloads1.1 Node Project1 - File Explorer.zip (1)Node Project1 - File Explorer"`).toString();
console.log(result);
}catch(err){
console.log(`Error: ${err}`);

输出::

'du' is not recognized as an internal or external command,
operable program or batch file.
node:child_process:903
throw err;
^
Error: Command failed: du -sh "C:UsershitesDownloads1.1 Node Project1 - File Explorer.zip (1)Node Project1 - File Explorerstaticcode"
'du' is not recognized as an internal or external command,
operable program or batch file.
at checkExecSyncError (node:child_process:826:11)
at execSync (node:child_process:900:15)
at calculateSizeD (C:UsershitesDownloads1.1 Node Project1 - File Explorer.zip (1)Node Project1 - File ExplorerlibcalculateSizeD.js:8:27)
at C:UsershitesDownloads1.1 Node Project1 - File Explorer.zip (1)Node Project1 - File ExplorerlibmainContent.js:55:57
at Array.forEach (<anonymous>)
at buildMainContent (C:UsershitesDownloads1.1 Node Project1 - File Explorer.zip (1)Node Project1 - File ExplorerlibmainContent.js:31:11)
at Server.respond (C:UsershitesDownloads1.1 Node Project1 - File Explorer.zip (1)Node Project1 - File Explorerlibrespond.js:72:29)
at Server.emit (node:events:390:28)

要运行此程序,您可以简单地在wsl(Windows Subsystem for Linux(中运行它,假设您已经安装了它,并且假设与它一起使用的wsl/Linux版本具有du。为我工作。你必须修改你的路径,所以你使用/mnt/c/。。。而不是C:\。。。

相关内容

最新更新