DONE Build complete. The dist directory is ready to be deployed.
DONE Build complete. The dist directory is ready to be deployed.问题
·
npm run build
命令执行完出现
DONE Build complete. The dist directory is ready to be deployed.
INFO Check out deployment instructions at https://cli.vuejs.org/guide/deployment.html
可以根据官方文档
目录需要启动一个 HTTP 服务器来访问 (除非你已经将 publicPath
配置为了一个相对的值),所以以 file://
协议直接打开 dist/index.html
是不会工作的。在本地预览生产环境构建最简单的方式就是使用一个 Node.js 静态文件服务器,例如 serve:
npm install -g serve
# -s 参数的意思是将其架设在 Single-Page Application 模式下
# 这个模式会处理即将提到的路由问题
serve -s dist
解决!
或者终端执行以下命令npm install http-server -g
npm install http-server -g
再cd进你项目的dist文件夹下,执行http-server
http-server
解决!
更多推荐
已为社区贡献1条内容
所有评论(0)