Browserify issues when building web-app for templating

I have a very specific question itintially but also a more general one about the best solution for what I’d like to achieve which would be great to get some me feedback on…

The sample code below produces the following error when creating bundle.js with browserify:
process.binding is not supported

Question 1: How can I resolve the error?
It seems “Browserify only shims certain common Node-specific properties.“ and (I think possibly also part of the problem) that the fs module will not work on the client.

So far I tried installing brfs :
browserify -t brfs basic.js --standalone MyLibrary > bundle.js
and installing browserify-fs
browserify -r fs:browserify-fs
But still getting error

Bit more Context:
I’m trying to use broswerify to compile a bundle.js so I can achieve some task running client side.
I have an angular web app which generates a json output file which can be downloaded.
I also have a gulp-based build framework using npm. The build runs based on the json outputed from the web app.
I’d like to connect these two processes so templating can be triggered/achieved via the app.
I’m running into difficulties with my solution to use browserify on js templating/task running as a lot of packages like fs seem to have client issues.

I don’t know if the issue is that I’m delving into stuff beyond my current knowledge and just not using brfs/browserify-fs to properly resolve things or whether I’m just employing a bad solution for what I want to start with.

Question 2: Is there a better approach than the one I am taking?


"use strict";

    var gulp = require('gulp');
    var sass = require('gulp-sass');
    var mergeJSON = require("merge-json") ;

    module.exports = MyLibrary;
    function MyLibrary() {};

    // WORKS
    MyLibrary.prototype.dataComp = function() {
      var configJson = require("./src/data/src/config.json") ;
      var sourceJson = require("./src/data/src/source.json") ;
      var obj1 = configJson ;
      var obj2 = sourceJson ;
      var result = mergeJSON.merge(obj1, obj2) ;
      console.log(result) ;

    // ERRORS
    MyLibrary.prototype.sassComp = function() {
        gulp.task('sass', function() {
            return gulp
                  precision: 2 

package.json depenencies

"dependencies": {
    "browserify-fs": "^1.0.0",
    "gulp": "^3.9.1",
    "gulp-sass": "^3.1.0",
    "merge-json": "0.1.0-b.3",
    "process": "^0.11.10",
    "url": "^0.11.0"
  "devDependencies": {
    "brfs": "^1.4.3",
    "browserify-fs": "^1.0.0"

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.