node-directory-tree icon indicating copy to clipboard operation
node-directory-tree copied to clipboard

FS.statSync is not a function

Open ivanvorona opened this issue 5 years ago • 3 comments

Hello,

i got this error: "FS.statSync is not a function at directoryTree (directory-tree.js?1168:57)"

upon debugging it comes from here:

function directoryTree (path, options, onEachFile, onEachDirectory) {
	const name = PATH.basename(path);
	path = options && options.normalizePath ? normalizePath(path) : path;
	const item = { path, name };
	let stats;
	console.log(path);
	**try { stats = FS.statSync(path); }**
	catch (e) { 
console.log(e);
return null; }

i guess it make sense to catch it and show? also, any idea why i am getting it?

ivanvorona avatar Mar 03 '20 19:03 ivanvorona

Hi @ivanvorona - are you running this under node? What version?

mihneadb avatar Mar 03 '20 20:03 mihneadb

Hi @mihneadb thank you for quick turnaround.

Yes - vueJS app, - tried on v10, installed the most recent stable v12 - the same result: ****>npm view webpack version 4.42.0

**>node -v v12.16.1

******>npm list webpack @0.1.0 ** +-- @vue/[email protected] | -- [email protected] +-- @vue/[email protected] | -- [email protected] deduped -- @vue/[email protected] -- [email protected] deduped

ivanvorona avatar Mar 03 '20 20:03 ivanvorona

@ivanvorona it looks like you are trying to run this in a browser or in a browser-like environment, where you don't have access to the FS module.

mihneadb avatar Mar 05 '20 12:03 mihneadb