“http://0.0.0.0:8080/ 的页面可能存在问题...” 的解决方案

运行 npm run serve 命令成功启动 Vue 项目后,将  http://localhost:8080/  复制在浏览器的地址栏中,页面出现如下报错:

 解决法案:在项目的 vue.config.js 文件中配置 devServer 属性即可:

const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
  devServer: {
    open: true,
    host: 'localhost',
    port: 8080
  }
})

最后重启项目,即可在 localhost:8080正常显示页面。

猜你喜欢

转载自blog.csdn.net/FunSober/article/details/127622069