Cannot find name ‘process‘. Do you need to install type definitions for node?

【问题描述】
当使用TypeScript和process时,我的规范会失败,出现如下错误消息:
Cannot find name ‘process‘. Do you need to install type definitions for node?_第1张图片

并且我已经在package.json文件中已经添加了@types/node类库
Cannot find name ‘process‘. Do you need to install type definitions for node?_第2张图片

解决办法:在tsconfig.json中配置

// tsconfig.json
{
     
  "compilerOptions": {
     
    "types": []
  }
}

改为

// tsconfig.json
{
     
  "compilerOptions": {
     
    // "types": []
  }
}

或者改为:

// tsconfig.json
{
     
  "compilerOptions": {
     
    "types": ["node"]
  }
}

你可能感兴趣的:(Angular,types/node,typescript,node,angular)