我无法使用GitHub页面发布我的角度应用程序。
看到此错误
about-me (master)*$ ngh
An error occurred!
Error: Unspecified error (run without silent option for detail)
at /usr/local/lib/node_modules/angular-cli-ghpages/node_modules/gh-pages/lib/index.js:232:19
at _rejected (/usr/local/lib/node_modules/angular-cli-ghpages/node_modules/q/q.js:844:24)
at /usr/local/lib/node_modules/angular-cli-ghpages/node_modules/q/q.js:870:30
at Promise.when (/usr/local/lib/node_modules/angular-cli-ghpages/node_modules/q/q.js:1122:31)
at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/angular-cli-ghpages/node_modules/q/q.js:788:41)
at /usr/local/lib/node_modules/angular-cli-ghpages/node_modules/q/q.js:604:44
at runSingle (/usr/local/lib/node_modules/angular-cli-ghpages/node_modules/q/q.js:137:13)
at flush (/usr/local/lib/node_modules/angular-cli-ghpages/node_modules/q/q.js:125:13)
at _combinedTickCallback (internal/process/next_tick.js:73:7)
at process._tickCallback (internal/process/next_tick.js:104:9)
答案 0 :(得分:0)
为生产版本运行ng build --prod
这将为您提供dist文件夹中的文件
首先从应用程序的Dist文件夹中获取所有相关文件
对我来说,资产文件夹main.bundle.js中的css文件是polyfills.bundle.js vendor.bundle.js
然后将此文件推送到您创建的仓库中。
1 - 如果您希望应用程序在根目录上运行 - 创建一个名为[yourgithubusername] .github.io的特殊仓库,并在主分支中填写这些文件
2 - 如果你想在不同于root的不同brach的子目录中创建这些页面,请创建一个分支gh-pages并在该分支中推送这些文件。
在这两种情况下,我们访问这些部署页面的方式都不同。
对于First Case,它将是https://[yourgithubusername].github.io,对于第二种情况,它将是[yourgithubusername] .github.io / [Repo name]。
如果假设您要使用sefcond案例部署它,请确保更改dist中index.html文件的基本URL,因为所有路由映射都取决于您提供的路径,并且应设置为[/ branchname ]
链接到此页面