啊米浴说的道理
感谢重新整理的项目,相比于前代整洁很多
今天来点大家想看的东西
Vue3项目怎么部署,本项目就怎样部署
首先把项目git到要部署的服务器上,或者git到自己本地电脑,npm构建完再上传到服务器也行
mkdir /otto
cd /otto
git clone https://github.com/HanaYabuki/otto-hzys.git
git完项目后,确认服务器上是否安装 npm 和 node.js ,如未安装须进行安装
直接apt install就行
npm和node.js都确认安装好了之后就可以开始用npm搭建了
以下命令用来安装所需依赖源
sudo npm install
依赖源安装完成后,以下命令用来打包这个活字印刷的Vue3项目
sudo npm run build
救一下啊
安装依赖源和打包的过程中也碰到几个问题,这里记录一下
- 显示错误 Error: @vitejs/plugin-vue requires vue (>=3.2.13) or @vue/compiler-sfc to be present in the dependen
Solution:Error: @vitejs/plugin-vue requires vue (>=3.2.13) or @vue/compiler-sfc to be present in the dependen_error: @vitejs/plugin-vue requires vue (>=3.2.13) -CSDN博客
- 显示错误 Note: The code generator has deoptimised the styling of /otto/node_modules/segmentit/dist/umd/segmentit.js as it exceeds the max of 500KB.
- 显示错误 dpkg: error processing package install-info (–configure): installed install-info package post-installation script subprocess returned error exit status 2 Errors were encountered while processing: install-info
Solution:dpkg: error processing package *** (–configure)错误解决办法-CSDN博客
- 执行 $ npm run build 构建时数次惨遭Killed
反复多执行几次,一般是性能、内存不足导致的;实在不行在本地电脑打包罢,总比那个小vps强()
- 显示错误 permission denied, mkdir ‘/otto/node_modules/.cache’
给文件的权限不足,给目录下所有文件 777 的权限
欧内的手,好汉
打包完成后就能在刚才 /otto 目录下的 /otto/dist 下找到打包好的页面文件,大概长下面这样
由于笔者用的是宝塔,就直接用宝塔的Nginx管理(侧边栏的 ”网站“)直接建站
直接将刚才 /otto/dist 下面的打包好的页面文件复制到 /www/wwroot/otto.oii.ink 文件夹下就行了
DNS一设置直接就可以访问了🆗
图片来自 X 上的 Hyde:“ダラダラ #絵フブキ https://t.co/nGvIbgsEiT” / X (twitter.com)