Cannot find name ‘process‘. Do you need to install type definitions for node?
程序员文章站
2024-01-20 09:33:04
...
【问题描述】
当使用TypeScript和process时,我的规范会失败,出现如下错误消息:
并且我已经在package.json文件中已经添加了@types/node
类库
解决办法:在tsconfig.json
中配置
// tsconfig.json
{
"compilerOptions": {
"types": []
}
}
改为
// tsconfig.json
{
"compilerOptions": {
// "types": []
}
}
或者改为:
// tsconfig.json
{
"compilerOptions": {
"types": ["node"]
}
}