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

【问题描述】
当使用TypeScript和process时,我的规范会失败,出现如下错误消息:
在这里插入图片描述

并且我已经在package.json文件中已经添加了@types/node类库
111

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

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

改为

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

或者改为:

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

猜你喜欢

转载自blog.csdn.net/a1056244734/article/details/108326580