Question

How to install multiple MEAN.JS applications on Ubuntu?

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.


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

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