TS2304: cannot find name require and process

偶尔善良 提交于 2019-12-04 23:50:31
pnekhaicuk

tsconfig.json:

compilerOptions: {
   ...
   "typeRoots": [ "../node_modules/@types" ],
   ...
}

or

main.ts:

/// <reference types="node" />

tsconfig.json

"compilerOptions": {
        ...,
        "lib": [
            "es2015",
            "es2015.iterable",
            "dom"
        ],
        "types": ["node"],
        ...
    }

"types" property would remove error related to 'require', 'process' and "lib" would remove some other errors related to Map,...

Building on @jordan28's answer, I also needed to add "node" to the types property array of tsconfig.app.json file in src as explained here

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