【问题标题】:How to fix this ERROR in node_modules/@types/moment-timezone/moment-timezone.d.ts(50,73)如何在 node_modules/@types/moment-timezone/moment-timezone.d.ts(50,73) 中修复此错误
【发布时间】:2023-04-09 10:29:01
【问题描述】:

我在 node_modules 中遇到错误,我该如何解决这个问题ERROR in node_modules/@types/moment-timezone/moment-timezone.d.ts(50,73)

ERROR in node_modules/@types/moment-timezone/moment-timezone.d.ts(50,73): error TS1005: ';' expected.
node_modules/@types/moment-timezone/moment-timezone.d.ts(50,88): error TS1005: ';' expected.
node_modules/@types/moment-timezone/moment-timezone.d.ts(50,107): error TS1005: ';' expected.
node_modules/@types/moment-timezone/moment-timezone.d.ts(51,23): error TS1005: ';' expected.
node_modules/@types/moment-timezone/moment-timezone.d.ts(51,45): error TS1005: ')' expected.
node_modules/@types/moment-timezone/moment-timezone.d.ts(51,67): error TS1109: Expression expected.
node_modules/@types/moment-timezone/moment-timezone.d.ts(51,70): error TS1005: ';' expected.
node_modules/@types/moment-timezone/moment-timezone.d.ts(51,71): error TS1128: Declaration or statement expected.
node_modules/@types/moment-timezone/moment-timezone.d.ts(51,75): error TS1005: ';' expected.
node_modules/@types/moment-timezone/moment-timezone.d.ts(52,28): error TS1005: ',' expected.
node_modules/@types/moment-timezone/moment-timezone.d.ts(52,50): error TS1109: Expression expected.
node_modules/@types/moment-timezone/moment-timezone.d.ts(52,60): error TS1005: ';' expected.
node_modules/@types/moment-timezone/moment-timezone.d.ts(53,16): error TS1005: ';' expected.
node_modules/@types/moment-timezone/moment-timezone.d.ts(54,23): error TS1109: Expression expected.
node_modules/@types/moment-timezone/moment-timezone.d.ts(54,33): error TS1005: ';' expected.
node_modules/@types/moment-timezone/moment-timezone.d.ts(56,25): error TS1109: Expression expected.
node_modules/@types/moment-timezone/moment-timezone.d.ts(56,34): error TS1005: ';' expected.
node_modules/@types/moment-timezone/moment-timezone.d.ts(67,1): error TS1128: Declaration or statement expected.

【问题讨论】:

  • 您是否给了它期望的;? :)
  • @karthi 验证您引用的时刻时区类型是否与您的 TypeScript 版本兼容。我最近遇到了这个问题,降级 @types/moment-timezone 的版本更正了构建错误。
  • @Karthi:你解决了上面的问题吗?\
  • 你找到解决办法了吗?

标签: angular npm npm-install npm-start npm-publish


【解决方案1】:

在 package.json 文件中更改您的代码。

从您的目录中删除 node_modulespackage-lock.json

然后更改版本并运行npm install

"@types/moment-timezone": "^0.5.7",

到:

"moment-timezone": "0.5.23",

【讨论】:

    【解决方案2】:

    更新@types/moment-timezone@0.5.7 来解决这个问题

    【讨论】:

      猜你喜欢
      • 2020-11-12
      • 2019-10-24
      • 2016-01-20
      • 2018-12-18
      • 2017-01-20
      • 2018-02-10
      • 2016-12-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多