javascriptnode.jsvue.jsvuejs2vue-cli

How to change port number in vue-cli project


How to change the Port number in the Vue-CLI project so that it runs on another port instead of 8080.


Solution

  • The port for the Vue-cli webpack template is found in your app root's myApp/config/index.js.

    All you have to do is modify the port value inside the dev block:

     dev: {
        proxyTable: {},
        env: require('./dev.env'),
        port: 4545,
        assetsSubDirectory: 'static',
        assetsPublicPath: '/',
        cssSourceMap: false
      }
    

    Now you can access your app with localhost:4545

    also if you have .env file better to set it from there