打包部署
构建
// 此处构建生成路径为./docs/.vuepress/dist,由config.js中配置: dest: ‘./docs/.vuepress/dist',
vuepress build docs导航到构建输出目录
// config.js中dest配置的输出目录是哪此处就cd进入哪,所有的git操作(包含初始,添加,提交等)都在此目录下
cd docs/.vuepress/distgit init
git add -A
git commit -m ‘deploy'
推到你的仓库
如果是部署到
<username>.github.io的主页上
git push origin master这时可能出现问题
fatal: ‘origin’ does not appear to be a git repository
以及fatal: Could not read from remote repository.
解决办法: 执行
git remote add origin git@github.com:<USERNAME>/<REPO>.git如果是部署到分支上
git push -f git@github.com:<USERNAME>/<REPO>.git master:gh-pages(git push -f git@github.com:momo-0902/wiki.git master:gh-pages)
可在package.json中配置脚本运行
npm start 运行项目
npm run build 打包
npm run deploy 部署










