运行 npm install --legacy-peer-deps 时,出现错误:调试失败。未处理的语法种类:未知

ili*_*ate 8 node.js npm angular-cli angular

我正在尝试运行 npm install --legacy-peer-deps

但出现一些错误。

这是错误:

Error: Error on worker #1: Error: Debug Failure. Unhandled SyntaxKind: Unknown.     
    at pipelineEmitWithHintWorker (portal/node_modules/typescript/lib/typescript.js:113076:22)
Run Code Online (Sandbox Code Playgroud)

我还在此行添加了日志 typescript.js:113076:22

            console.log(node, node.kind)

            ts.Debug.fail("Unhandled SyntaxKind: ".concat(ts.Debug.formatSyntaxKind(node.kind), "."));
Run Code Online (Sandbox Code Playgroud)

输出是

t undefined
Run Code Online (Sandbox Code Playgroud)

我认为这可能是节点版本问题,但不确定发生了什么,如果有人可以提供帮助,我非常感激。如果需要提供更多信息,请告诉我。

Jer*_*emy 15

我今天也遇到这个问题了。我发现以 Typescript < 4.8 为目标是解决这个问题的关键。

在您的 package.json 中将您的打字稿版本(开发依赖项)更改为类似于此的内容: "typescript": "<4.8" 或专门设置版本,例如 "typescript": "4.6.4"

您应该检查 node_modules 文件夹以确保您没有安装我认为具有这种不兼容性的 4.8.2 软件包。