Search code examples
angularjsnode.jsbrowserifyfs

fs.readdirSync is not a function


on my main.js file i have:

var http = require('http'),
prompt = require('prompt'),
fs = require('browserify-fs');
require("shelljs/global");

On my console I run: browserify main.js -o bundle.js

I then add loading my file bundle.js to my index file

and finally, when i run my project, its says this:

console message error,

im stuck on this, could ani1 have a solution??


Solution

  • That is because the function readdirSync actually doesn't exist on browserify-fs.

    The browserify-fs internally uses level-filesystem for using fs and below given is the list of all functions which are supported by this library.

    level-filesystem, list of all supported function.