briank
By:
briank

How to install multiple MEAN.JS applications on Ubuntu?

August 8, 2015 884 views
MEAN Nginx Node.js One-Click Install Apps

I used the one-click install to create a sample MEAN.JS app in the /opt/mean directory. I have successfully started this app and configured nginx to route requests for a particular domain to it.

I am attempting to add a second MEAN.JS app to take requests for another domain. I copied /opt/mean to /opt/mean2, changed the port its listening on from 3000 to 4000, and ran grunt. But it gives me an error that port 35729 is already in use by another process.

If I reboot ubuntu, I can run grunt in either of my apps and start the app successfully. But, when I try to start the other one, I get a fatal error that port 35729 is already in use by another process.

1 Answer

Port 35729 is the default port for Grunt's live reload feature. It causes your site to automatically refresh if changes are made. It's great for development, but you might not want it in use in production.

From the Grunt docs:

Type: Boolean or Number
Default: false

Set to true or a port number to inject a live reload script tag into your page using connect-livereload.

Yoiu can change its behavior by editing your gruntfile.js file. Find the "watch" section:

    watch: {
      serverViews: {
        files: defaultAssets.server.views,
        options: {
          livereload: true
        }
      },
      serverJS: {
        files: _.union(defaultAssets.server.gruntConfig, defaultAssets.server.allJS),
        tasks: ['eslint'],
        options: {
          livereload: true
        }
      },
      clientViews: {
        files: defaultAssets.client.views,
        options: {
          livereload: true
        }
      },
      clientJS: {
        files: defaultAssets.client.js,
        tasks: ['eslint'],
        options: {
          livereload: true
        }
      },
      clientCSS: {
        files: defaultAssets.client.css,
        tasks: ['csslint'],
        options: {
          livereload: true
        }
      },
      clientSCSS: {
        files: defaultAssets.client.sass,
        tasks: ['sass', 'csslint'],
        options: {
          livereload: true
        }
      },
      clientLESS: {
        files: defaultAssets.client.less,
        tasks: ['less', 'csslint'],
        options: {
          livereload: true
        }
      }
    },

Change livereload: true to livereload: false to disable it completely. This sed command would do it all in one shot:

  • sed -i 's/livereload: true/livereload: false/g' gruntfile.js
Have another answer? Share your knowledge.