Koji Sugano
Koji Sugano

Reputation: 59

Not running at local when "npm run serve" command in vue project

I was trying to make some app with vue and installed npm command.

when I run "npm run serve" command, I get the following messages. It seems that I was supposed to run app at "http://localhost:8080/" and was able to access sample pages, not like "x86_64-apple-darwin13.4.0:" stuff.

is it possible to solve this with changing config file or something ?

App running at:
  - Local:   http://x86_64-apple-darwin13.4.0:8080/
  - Network: http://x86_64-apple-darwin13.4.0:8080/

  Note that the development build is not optimized.
  To create a production build, run npm run build.

I am supposed to access to http://localhost:8080/ and would get some sample pages.

Upvotes: 0

Views: 2235

Answers (2)

Michael Schomburg
Michael Schomburg

Reputation: 88

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

Upvotes: 5

Pavlo
Pavlo

Reputation: 91

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',
  }
}

Upvotes: 0

Related Questions