2

当我尝试通过以下方式将我的 Angular 应用程序部署到 GitHub 页面时,我遇到了以下错误

角度剪辑页面

错误信息

这些是我在将网站推送到 GitHub 时使用的 bash 命令

ng build --prod --base-href "https://dinith72.github.io/aiesecLoginForm/" - 创建构建版本

ngh --dir dist/AiesecLogin -m "adding request for python serve"

我尝试了上面发布的 git 问题中提到的选项,但找不到我的问题的解决方案。非常感谢您。

4

1 回答 1

1

我用travis-ci这个更好,在每次提交中都会自动构建和部署 github 页面,它并没有那么复杂,只需在构建中添加travis.yml和更新 baseurlangular.json

像这样:

"baseHref": "https://username.github.io/repo-name/"

作为我的例子:

"baseHref": "https://malbarmawi.github.io/angular-lessons/"

travis.yml

language: node_js
node_js:
  - "9"
dist: trusty
sudo: false

branches:
  only:
    - master

cache:
  directories:
    - node_modules

install:
  - npm i @angular/cli@6.2.4 -g
  - npm i

script:
  - ng build --prod
deploy:
  provider: pages
  skip_cleanup: true
  github_token: $GITHUB_TOKEN
  local_dir: dist/
  on:
    branch: master

最后得到github 令牌,你可以查看我的项目

这篇文章可以帮助我使用 Travis-CI 将您的 Angular 应用程序部署到 GitHub 页面

于 2019-01-16T08:30:00.577 回答