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 = require('fs');
I'm getting a red squiggly under the 'fs' inside the parenthesis and the error message is [ts] Cannot find module 'fs'.
The file has a .ts extension. I'm new to JavaScript and to TypeScript, but I was under the impression that fs
was a core module, so how could it not be found? How do I fix the problem?
Other things that I tried already:
- Putting a simple function body in the file and then compiling on the command line with
tsc
. I get an essentially equivalent error there:error TS2307: Cannot find module 'fs'.
- On the command line
sudo npm install fs -g
. This reports apparent success, but doesn't fix the problem.
I poked around SE and the web, but the answers that seemed close all appear to assume that 'fs' is available.