typescript
I recently ran into the error “Cannot find module 'fs' or its corresponding type declarations.ts(2307)
” while I was using VSCode and I was searching for a fix.
Turns out all I needed to do was to add the definition file for node types in my project.
npm i -D @types/node
BashAfter that, reloading the window fixed the error!
If you are still facing the error, maybe the .tsconfig file needs to be updated too. The types
array inside compilerOptions needs to have “node
” as a value inside the array.
{
"compilerOptions": {
"types": [
"node"
]
},
}
JSONAnd that should hopefully solve the Cannot find module 'fs' or its corresponding type declarations.ts(2307)
error.
I am terrible at optimizing my keyboard layout for anything. But off lately, my little…
I recently switched completely to the Brave browser and have set ad blocking to aggressive…
I was preparing a slide deck for a hackathon and decided to put in a…
I have been using npx a lot lately, especially whenever I want to use a…
Manually copy-pasting the output of a terminal command with a mouse/trackpad feels tedious. It is…
While working on a project, I wanted to do an integrity check of a file…