【问题标题】:When I npm runbuild in vue.js get the error Interface 'NodeRequire' cannot simultaneously extend types 'Require'当我在 vue.js 中 npm runbuild 得到错误接口 'NodeRequire' 不能同时扩展类型 'Require'
【发布时间】:2020-04-15 21:40:21
【问题描述】:
ERROR in C:/phpStudy2018/PHPTutorial/WWW/Tms.Web/node_modules/@types/node/globals.d.ts(139,11):
139:11 Interface 'NodeRequire' cannot simultaneously extend types 'Require' and 'RequireFunction'.
  Named property 'cache' of types 'Require' and 'RequireFunction' are not identical.
    137 |
    138 | // For backwards compability
  > 139 | interface NodeRequire extends NodeJS.Require {}
        |           ^
    140 | interface RequireResolve extends NodeJS.RequireResolve {}
    141 | interface NodeModule extends NodeJS.Module {}
    142 |

 error  in C:/phpStudy2018/PHPTutorial/WWW/Tms.Web/node_modules/@types/node/globals.d.ts

ERROR in C:/phpStudy2018/PHPTutorial/WWW/Tms.Web/node_modules/@types/node/globals.d.ts(139,11):

我的环境是 vue.js + typescript。不知道是我的配置有问题还是第三方包有问题 你能给我一些有用的建议吗 谢谢

【问题讨论】:

    标签: typescript vue.js webpack


    【解决方案1】:

    我有同样的问题。

    @types/node 的版本是 13.1.0 格林威治标准时间 2019 年 12 月 23 日星期一 16:40:55 发布

    在我的情况下,当我使用以前的版本 12.12.22 时它可以工作

    npm install --save-dev @types/node@12.12.22

    【讨论】:

    【解决方案2】:

    我认为最好从编译中排除 @types 定义: https://stackoverflow.com/a/57113847/1704895

    非常简单(tsconfig.json):

    {
      "compilerOptions": {
        ...,
        "types": []
      }
    }
    

    【讨论】:

      猜你喜欢
      • 2019-02-06
      • 2019-04-07
      • 2020-02-19
      • 2018-06-18
      • 2019-05-22
      • 2021-04-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多