简体   繁体   中英

Typescript Cannot find Module "fs" even though @types/node installed

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.

在 ts/js 文件中导入 fs

import fs from 'fs'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM