前端:
D:
cd D:\Project\django-vue-admin\web
npm install yarn yarn install --registry=https://registry.npmmirror.com
报错
yarn config set ignore-engines true
yarn build
报错:These dependencies were not found:
c盘:
npm install -g yarnyarn install --registry=https://registry.npmmirror.com
d盘:
cd D:\Project\django-vue-admin\web
yarn build
问题:yarn构建成功,localhost拒绝访问
看到Done以为启动成功,但这只是dist目录准备好部署
但localhost拒绝访问,原因http未启动
报错如下:
DONE Build complete. The dist directory is ready to be deployed.
INFO Check out deployment instructions at https://cli.vuejs.org/guide/deployment.html
接着我们点击链接获取解决方法:
解决
方法1
#官网解决办法
npm install -g serve
# -s flag means serve it in Single-Page Application mode
# which deals with the routing problem below
serve -s dist
方法2
npm install http-server -g
再切换至dist目录,运行:
http-server
如图构建成功
注:这里参照了 DONE Build complete. The dist directory is ready to be deployed.-CSDN博客的方法