TypeScript - Puppeteer library error: “Cannot find name 'Element'”

给你一囗甜甜゛ 提交于 2020-04-17 04:31:05

问题


I have included puppeteer-core as a dependency in my TypeScript project, and am using Visual Studio 2019. When I try to build the project, I get this error below (as shown by the red squiggly underline under Element):

error TS2304: Build:Cannot find name 'Element'

How can I resolve this please?


回答1:


Adding dom to my tsconfig.json got rid of the issue:

{
    "compilerOptions": {
        "lib": [
            "es2018",
            "dom"
        ]
    }
}


来源:https://stackoverflow.com/questions/57999416/typescript-puppeteer-library-error-cannot-find-name-element

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!