【问题标题】:lodash error while building /@types/lodash/common/object.d.ts (1188,142): '(' expected构建 /@types/lodash/common/object.d.ts (1188,142) 时出现 lodash 错误:'(' 预期
【发布时间】:2020-12-21 17:53:03
【问题描述】:

一切都很好,但突然我的构建开始失败。这些是我看到的错误

ERROR in /node_modules/@types/lodash/common/function.d.ts (852,68): ';' expected.

ERROR in /node_modules/@types/lodash/common/common.d.ts (9,11): ';' expected.

ERROR in /node_modules/@types/lodash/common/common.d.ts (9,56): '(' expected.

ERROR in /node_modules/@types/lodash/common/common.d.ts (9,72): '(' expected.

ERROR in /node_modules/@types/lodash/common/common.d.ts (9,86): '(' expected.

ERROR in /node_modules/@types/lodash/common/common.d.ts (9,103): '(' expected.

我的 package.json 显示了 typescript 和 lodash 的以下版本:

"@types/lodash": "^4.14.74",
"typescript": "2.1.5",

我尝试使用 npm i -D @types/lodash@ts2.1.5 ,但这并没有帮助,因为 npm 会引发错误,提示找不到兼容版本。

谁知道我可以使用哪个版本的 lodash?

【问题讨论】:

  • 听起来像语法错误..?尝试重新安装它
  • 之前运行良好
  • 无论如何我都会尝试重新安装模块,应该没有任何危害,而且可能是罪魁祸首
  • 我尝试重新安装模块后仍然出现同样的错误

标签: javascript typescript npm lodash


【解决方案1】:

我解决了这个问题

npm install --save @types/lodash@4.14.74

仅 npm install 并没有安装该依赖项

【讨论】:

    猜你喜欢
    • 2019-09-17
    • 1970-01-01
    • 2021-07-12
    • 2020-03-27
    • 2019-07-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多