[Vuejs]-Vue starts port 80 under mac and reports an error

1👍

This error happens when the port is already in use. You can solve this with two options.

  • Kill the port

  1. Check if the port is already in use using this command lsof -i :80
  2. Kill the port using the PID that will be provided if the port was in use using kill {{PID}}

  • Run the project on a different port

You can actually run your vue app on a different port

  1. Using Npm -> npm run serve --port 8080
  2. Using Yarn -> yarn serve --port 8080
👤Amini

0👍

As your machine gets started, it will need to know the mapping of some hostnames to IP addresses before DNS can be referenced. This mapping is kept in the /etc/hosts file. In the absence of a name server, any network program on your system consults this file to determine the IP address that corresponds to a host name.

127.0.0.1           localhost       
127.0.0.1           yourdomain.com

Then you can run npm run dev --host yourdomain.com with custom host/port using vue-cli.

Also you can change the devServer in vue.config.js

Leave a comment