加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

在角7(打字稿3.1.3)中找不到名称’require’

发布时间:2020-12-17 17:52:34 所属栏目:安全 来源:网络整理
导读:我的问题是为什么会出现这个错误? ERROR in src/app/p2p/p2p.component.ts(14,16): error TS2580: Cannot find name ‘require’. Do you need to install type definitions for node? Try npm i @types/node . 我安装了 @types/nodein app/tsconfig.app.js
我的问题是为什么会出现这个错误?

ERROR in src/app/p2p/p2p.component.ts(14,16): error TS2580: Cannot
find name ‘require’. Do you need to install type definitions for node?
Try npm i @types/node.

我安装了

@types/node
in app/tsconfig.app.json have add 
"types": [
    "node" 
  ],"typeRoots": [ 
  "../node_modules/@types"
 ]

但有错误找不到’要求’

解决方法

缺少类型节点

install @ types / node:

npm install --save @types/node

要么

yarn add @types/node

编辑你的src / tsconfig.json添加:

{
    "compilerOptions": {
        "types": ["node"]
    }
}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读