how to use @types/node in node application
Solution 1
For TypeScript 1.8, it might be better to typings
to install the node types. For detail see the quickstart at: https://basarat.gitbooks.io/typescript/content/docs/quick/nodejs.html.
Solution 2
Since TypeScript 2.x, all typings are installed using npm
like this: npm install @types/node
.
Pratik Gaikwad
I am a full time student pursuing Master's degree in Computer Science(M.S.) in Stevens Institute of Technology, Hoboken, New Jersey, USA. I have worked as software developer for more than 4 years with Tata Consultancy Services. During my professional tenure I've worked in below technologies: .Net framework(4.0,4.5), ASP.NET(web form, MVC), JQuery(Core, UI), NodeJS, Angular, Typescript, HTML, CSS, WCF, SQL
Updated on August 15, 2020Comments
-
Pratik Gaikwad over 3 years
I am working in VSCode on Ubuntu 16.04. I've created node project using below commads:
npm init tsc --init
I've created a new file called index.ts. I'm trying to use fs and readling to read file contents. but when I am writing below lines of code at the top of index.d.ts:
import fs = require('fs'); import readline = require('readline');
I'm getting below error: can not find module 'fs' and can not find module 'readline'
even process is not found. I've installed typings of node from here using below command:
sudo npm install @types/node -global --save
Can anyone please help me how to resolve this error?
-
Devin Rhode about 2 yearsLinking a different question with similar keywords: "When should I install "@types/node" package?" "It seems like VSCode automatically has it installed" stackoverflow.com/questions/60580624/…