据以下命令对项目进行打包:
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
直接打开上面的网址访问就可以了。