How to find module “fs” in VS Code with TypeScript?

前端 未结 6 1793
一生所求
一生所求 2021-01-30 12:17

I\'m running on a MacBook Air. I installed VS Code as an IDE and also have TypeScript installed.

I have a simple file with just this line:

import fs = req         


        
6条回答
  •  不思量自难忘°
    2021-01-30 12:54

    You need to include the definition file for node.

    TypeScript 2.0+

    Install using npm:

    npm install --save-dev @types/node
    

    TypeScript < 2.0

    If you use typings then you can run this command:

    typings install dt~node --global --save
    

    Or if you are using typings < 1.0 run:

    typings install node --ambient --save
    

    Or if all else fails, manually download the file here and include it in your project.

提交回复
热议问题