I know the usual fix for this one is to install @types/node , and I have 10.12.23 of that installed.
This appears to be a strange error and I am a bit baffled by it. I have 2 other npm modules installed: config ( which requires @types/config ) and firebase-admin which must have it's own typescript types. Also using VS code version 1.31 . I even tried installing an older version of @types/node
The following works fine
import admin from "firebase-admin";
import fs from "fs";
The following fails: cannot find module 'fs'
import admin from "config";
import fs from "fs";
The following fails: cannot find module 'fs'
import fs from "fs";
I am not using any other packages / webpack or anything else. Any ideas are appreciated.
Besides installing @types/node
, check that the tsconfig.json:
types
, or make sure "node" is included therenoResolve
does not exist or is set to false
esModuleInterop
is set to true
or you'll get error Module "fs" has no default export
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With