[Vuejs]-Not running at local when "npm run serve" command in vue project

5👍

It seems like your host environment was set to x86_64-apple-darwin13.4.0, you should be able to set the variable in your bash_profile like this
HOST="localhost"

after that reload the environment with source ~/.bash_profile

0👍

Looks like you can find an answer to your question here – https://forum.vuejs.org/t/npm-run-serve-is-not-defaulting-to-localhost/88007/13.

In a short:

  • Add vue.config.js file in a root (same level as package.json file) if you don’t have one

  • Add the following settings to vue.config.js

module.exports = {
  devServer: {
    host: '127.0.0.1',
    port: 8080,
    public: 'localhost:8080',
  }
}
👤Pavlo

Leave a comment