[SOLVED] problem with “ReferenceError: fs is not defined”

Issue

This Content is from Stack Overflow. Question asked by BLACK JONI

so ive been trying to fix this problem for the past hour and can get it to work, its probably a stupid mistake, but what you see here is my fs.readdir is defined.

vsc error + code



Solution

You need to import fs. Put this above line 25 or your first use of fs

const fs = require('fs');


This Question was asked in StackOverflow by BLACK JONI and Answered by Markus It is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?