使用 vue 项目部署到 github 页面时出现问题
Problems deploying to github pages with vue project
我正在尝试将 vue-cli 项目部署到 github 页面,我按照本网站和 github 支持上的说明进行操作。
delpoy vue-cli 到 github 页:
https://medium.com/@mwolfhoffman/deploying-to-github-pages-with-vue-webpack-cli-5b2ba17f14a0
正在配置 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
not follow the repository naming scheme username.github.io or orgname.github.io
这是我的存储库:https://github.com/leewei05/blog
但是结果一直是404,还是不知道是什么问题,求助!
原来我的配置路径错误,这里是将新的 vue-cli 项目部署到 git 中心页面的步骤。
(需要先安装npm和vue-cli)
$ vue init webpack [projectName]
$ cd [projectName]
$ npm install
- 转到您的 config/index.js 文件
- 像这样修改构建部分:
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
}
$ npm run build
- 将其推送到您的 github 存储库
- 转到存储库中的设置
- 找到您的 GitHub 页面部分并将来源更改为
'master' -> 'master/docs'
- 您的页面应该在
https://[userName].github.io/[repositoryName]/#/
- 祝你好运!
我正在尝试将 vue-cli 项目部署到 github 页面,我按照本网站和 github 支持上的说明进行操作。
delpoy vue-cli 到 github 页: https://medium.com/@mwolfhoffman/deploying-to-github-pages-with-vue-webpack-cli-5b2ba17f14a0
正在配置 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
not follow the repository naming scheme username.github.io or orgname.github.io
这是我的存储库:https://github.com/leewei05/blog
但是结果一直是404,还是不知道是什么问题,求助!
原来我的配置路径错误,这里是将新的 vue-cli 项目部署到 git 中心页面的步骤。
(需要先安装npm和vue-cli)
$ vue init webpack [projectName]
$ cd [projectName]
$ npm install
- 转到您的 config/index.js 文件
- 像这样修改构建部分:
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
}
$ npm run build
- 将其推送到您的 github 存储库
- 转到存储库中的设置
- 找到您的 GitHub 页面部分并将来源更改为 'master' -> 'master/docs'
- 您的页面应该在
https://[userName].github.io/[repositoryName]/#/
- 祝你好运!