vue cli3.0 npm run build 打包并在本地查看时页面空白问题
据以下命令对项目进行打包:npm run build命令执行完出现DONEBuild complete. The dist directory is ready to be deployed.INFOCheck out deployment instructions at https://cli.vuejs.org/guide/deployment.html看了一下,build complete,
·
据以下命令对项目进行打包:
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
看了一下,build complete,嗯完成了,后面的也没有看,直接打开了生成的dist文件夹下的index.html
打开后出现一个空白页面,并且控制台是上面这样的。
解决办法:
执行下面命令:
npm install http-server -g 全局
然后在dist文件下执行:
[root@VM-16-6-centos dist]# /www/server/nodejs/v8.9.4/bin/http-server
Starting up http-server, serving ./
http-server version: 14.0.0
http-server settings:
CORS: disabled
Cache: 3600 seconds
Connection Timeout: 120 seconds
Directory Listings: visible
AutoIndex: visible
Serve GZIP Files: false
Serve Brotli Files: false
Default File Extension: none
Available on:
http://127.0.0.1:8081
http://172.21.16.6:8081
Hit CTRL-C to stop the server
直接打开上面的网址访问就可以了。
更多推荐
已为社区贡献2条内容
所有评论(0)