Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm run dev 在虚拟机上无法用ip访问 #4

Open
Mirror198829 opened this issue Dec 12, 2017 · 0 comments
Open

npm run dev 在虚拟机上无法用ip访问 #4

Mirror198829 opened this issue Dec 12, 2017 · 0 comments

Comments

@Mirror198829
Copy link
Owner

问题:用新版vue-cli在虚拟机上使用npm run dev启动服务,通过ip无法访问页面

原因:在新版vue-cli中的config/index.js

module.exports = {
  dev: {

    // Paths
    assetsSubDirectory: 'static',
    assetsPublicPath: '/',
    proxyTable: {},

    // Various Dev Server settings
    host: 'locahost', // can be overwritten by process.env.HOST
    
    ……

host设置为了localhost。

解决方法:讲localhost修改为0.0.0.0

module.exports = {
  dev: {

    // Paths
    assetsSubDirectory: 'static',
    assetsPublicPath: '/',
    proxyTable: {},

    // Various Dev Server settings
    host: '0.0.0.0', // can be overwritten by process.env.HOST
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant