简体   繁体   English

使用vue项目部署到github页面的问题

[英]Problems deploying to github pages with vue project

I'm trying to deploy a vue-cli project to github pages, I followed the instructions on this website and on github support. 我正在尝试将vue-cli项目部署到github页面,我按照本网站上的说明和github支持。

delpoy vue-cli to github pages: https://medium.com/@mwolfhoffman/deploying-to-github-pages-with-vue-webpack-cli-5b2ba17f14a0 delpoy vue-cli到github页面: https ://medium.com/@mwolfhoffman/deploying-to-github-pages-with-vue-webpack-cli-5b2ba17f14a0

Configuring github pages https://help.github.com/articles/configuring-a-publishing-source-for-github-pages/ 配置github页面https://help.github.com/articles/configuring-a-publishing-source-for-github-pages/

Setting -> source -> master /docs 设置 - >源 - >主/文档

have a /docs folder in the root of the repository 在存储库的根目录中有一个/ docs文件夹

not follow the repository naming scheme username.github.io or orgname.github.io 不遵循存储库命名方案username.github.io或orgname.github.io

Here is my repository : https://github.com/leewei05/blog 这是我的存储库: https//github.com/leewei05/blog

But the result keep giving me 404, still doesn't know what my problem is, please help! 但结果一直给我404,还不知道我的问题是什么,请帮忙!

It turned out I've got the wrong config path, here are the steps to deploy a new vue-cli project to git hub pages. 原来我的配置路径错误,这里是将新的vue-cli项目部署到git hub页面的步骤。

(You got to install npm and vue-cli first) (你必须先安装npm和vue-cli)

  1. $ vue init webpack [projectName] $ vue init webpack [projectName]
  2. $ cd [projectName] $ cd [projectName]
  3. $ npm install $ npm安装
  4. go to your config/index.js file 转到config / index.js文件
  5. modify your build section like this: 像这样修改你的构建部分:

    build: { index: path.resolve(__dirname, '../docs/index.html'), assetsRoot: path.resolve(__dirname, '../docs'), assetsSubDirectory: 'static', assetsPublicPath: '', productionSourceMap: true, devtool: '#source-map', productionGzip: false, productionGzipExtensions: ['js', 'css'], bundleAnalyzerReport: process.env.npm_config_report }

  6. $ npm run build $ npm run build

  7. push it to your github repository 将它推送到您的github存储库
  8. go to the setting in your repository 转到存储库中的设置
  9. find your GitHub Pages Section and change the source from 'master' -> 'master/docs' 找到你的GitHub页面部分,并从'master' - >'master / docs'更改源代码
  10. your page should be on ' https://[userName].github.io/[repositoryName]/#/ ' 您的页面应位于' https:// [userName] .github.io / [repositoryName] /#/ '
  11. Good luck on that! 祝你好运!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM