前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >ts执行文件报错

ts执行文件报错

作者头像
蓓蕾心晴
发布2023-08-09 18:42:32
4180
发布2023-08-09 18:42:32
举报
文章被收录于专栏:前端小叙前端小叙

我重新安装了项目的 npm 包,执行 ts 文件报错:

代码语言:javascript
复制
tsc src/index.ts
代码语言:javascript
复制
node_modules/@types/node/globals.d.ts:72:13 - error TS2403: Subsequent variable declarations must have the same type.  Variable 'AbortSignal' must be of type '{ new (): AbortSignal; prototype: AbortSignal; abort(reason?: any): AbortSignal; timeout(milliseconds: number): AbortSignal; }', but here has type '{ new (): AbortSignal; prototype: AbortSignal; }'.

72 declare var AbortSignal: {
               ~~~~~~~~~~~

  ../../../../.nvm/versions/node/v16.1.0/lib/node_modules/typescript/lib/lib.dom.d.ts:2304:13
    2304 declare var AbortSignal: {
                     ~~~~~~~~~~~
    'AbortSignal' was also declared here.


Found 1 error in node_modules/@types/node/globals.d.ts:72

报错原因可能为版本不匹配的问题,解决办法,删除 项目的 node_modules 及 package-lock.js文件 重新执行 npm install 即可解决。

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2023-08-03,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档