1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > vue cli3.0 npm run build 打包并在本地查看时页面空白问题

vue cli3.0 npm run build 打包并在本地查看时页面空白问题

时间:2022-12-19 09:08:32

相关推荐

vue cli3.0 npm run build 打包并在本地查看时页面空白问题

据以下命令对项目进行打包:

npm run build

命令执行完出现

DONE Build complete. The dist directory is ready to be deployed.

INFO Check out deployment instructions at /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-serverStarting up http-server, serving ./http-server version: 14.0.0http-server settings: CORS: disabledCache: 3600 secondsConnection Timeout: 120 secondsDirectory Listings: visibleAutoIndex: visibleServe GZIP Files: falseServe Brotli Files: falseDefault File Extension: noneAvailable on:http://127.0.0.1:8081http://172.21.16.6:8081Hit CTRL-C to stop the server

直接打开上面的网址访问就可以了。

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。