how to run vue js project on different port

To run a Vue.js project on a different port, you can follow these steps:

  1. Open the terminal or command prompt in the root directory of your Vue.js project.
  2. Locate the package.json file in your project's root directory.
  3. Open the package.json file in a text editor.
  4. Find the "scripts" section within the package.json file.
  5. Look for the "serve" script, which is responsible for running the development server.
  6. By default, the "serve" script looks something like this: "serve": "vue-cli-service serve".
  7. To specify a different port, modify the "serve" script to include the --port flag followed by the desired port number. For example: "serve": "vue-cli-service serve --port 8080".
  8. Save the changes to the package.json file.
  9. In the terminal or command prompt, run the following command to start the development server with the updated port configuration: npm run serve or yarn serve.

Once the development server starts running on the specified port, you should be able to access your Vue.js project by visiting http://localhost:<port> in your web browser, where <port> is the number you specified in the "serve" script.

This allows you to run your Vue.js project on a different port than the default port (usually 8080) and avoid port conflicts with other running applications on your local machine.