vue cli different port code example

Example: How to change port number in vue-cli project

with Vue CLI v3
package.json: Add port option to serve script: 
	vue-cli-service serve --port xxxx

Example:
in file package.json edit 
scripts": {
    "serve": "vue-cli-service serve
    ........
}

to


scripts": {
    "serve": "vue-cli-service serve --port 3000",
    .........
}    

OR

CLI Option --port to npm run serve, e.g. npm run serve -- --port 3000. 
Note the --, this makes passes the port option to the npm script 
instead of to npm itself. Since at least v3.4.1, 
it should be e.g. vue-cli-service serve --port 3000

Tags:

Misc Example