TypeError: Cannot read property 'name' of undefined at new WebpackCLI

TypeError: Cannot read property 'name' of undefined at new WebpackCLI

我正在尝试在我的项目中 运行 yarn dev 但没有任何反应,只是在下面显示此错误:

[webpack-cli] TypeError: Cannot read property 'name' of undefined
    at new WebpackCLI (C:\Users\mikae\Desktop\phaser-game-multiplayer\game\node_modules\webpack-cli\lib\webpack-cli.js:18:22)
    at runCLI (C:\Users\mikae\Desktop\phaser-game-multiplayer\game\node_modules\webpack-cli\lib\bootstrap.js:7:21)
    at Object.<anonymous> (C:\Users\mikae\Desktop\phaser-game-multiplayer\game\node_modules\webpack-cli\bin\cli.js:25:5)
    at Module._compile (node:internal/modules/cjs/loader:1092:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1121:10)
    at Module.load (node:internal/modules/cjs/loader:972:32)
    at Function.Module._load (node:internal/modules/cjs/loader:813:14)
    at Module.require (node:internal/modules/cjs/loader:996:19)
    at require (node:internal/modules/cjs/helpers:92:18)
    at runCli (C:\Users\mikae\Desktop\phaser-game-multiplayer\game\node_modules\webpack\bin\webpack.js:69:2)
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

我的 webpack-cli.js 显示错误的部分

this.program = program;
this.program.name("webpack");
this.program.configureOutput({
        writeErr: this.logger.error,
        outputError: (str, write) =>
            write(
                `Error: ${this.utils.capitalizeFirstLetter(str.replace(/^error:/, "").trim())}`,
            ),
    });

我能做什么?我只想初始化我的程序。

我今天在自己的项目中遇到了完全相同的错误。过去构建工作正常,但自从我从源代码创建了一个新存储库并尝试从新位置构建它后,构建失败了。 除了删除整个目录并重新克隆存储库外,没有任何帮助。之后构建成功完成。