gpt4 book ai didi

javascript - 如何将 Angular 2 App 部署到 Github Pages?

转载 作者:搜寻专家 更新时间:2023-10-31 23:20:07 26 4
gpt4 key购买 nike

几周前,我能够将使用 Angular Cli 工具制作的应用程序发布到 Github Pages,但现在当我尝试使用命令 ng github-pages: deploy 时,我收到错误: 指定的命令 github-pages:deploy 无效。。这github thread建议该命令最近已被删除,并且 petersgiles 建议遵循这些准则而不是发布页面:

1. npm install -g angular-cli-ghpages (doesn't work if its not global)
2.Then in your package.json
"scripts": { "deploy": "ng build -sm -ec -bh /repo name/ & ngh --silent=false",...
3.when you want to deploy npm run deploy

我按照这些说明操作,但收到错误:在 mybiography@0.0.0 部署脚本 'ng build -sm -ec -bh/aboutme/& ngh --silent=false' 失败。 我的 npm 和 node js 是最新的,错误表明问题出在我的 package.json 文件中。

我的终端继续呈现我程序的所有五个 block ,但没有指向该网站的链接。我能做些什么来解决这个问题吗?我完成了我的网站,只需要在某个地方托管它。作为初学者,我很迷茫,所以请指出任何明显的错误或遗漏的信息。

包.json

{
"name": "aboutme",
"version": "0.0.0",
"license": "MIT",
"angular-cli": {},
"scripts": {
"deploy": "ng build -sm -ec -bh /aboutme/ & ngh --silent=false",
"ng": "ng",
"start": "ng serve",
"test": "ng test",
"pree2e": "webdriver-manager update --standalone false --gecko false",
"e2e": "protractor" },
"private": true,
"dependencies": {
"@angular/common": "^2.3.1",
"@angular/compiler": "^2.3.1",
"@angular/core": "^2.3.1",
"@angular/forms": "^2.3.1",
"@angular/http": "^2.3.1",
"@angular/platform-browser": "^2.3.1",
"@angular/platform-browser-dynamic": "^2.3.1",
"@angular/router": "^3.3.1",
"core-js": "^2.4.1",
"rxjs": "^5.0.1",
"ts-helpers": "^1.1.1",
"zone.js": "^0.7.2"
},
"devDependencies": {
"@angular/cli": "^1.0.0-rc.1",
"@angular/compiler-cli": "^2.3.1",
"@types/jasmine": "2.5.38",
"@types/node": "^6.0.42",
"codelyzer": "~2.0.0-beta.1",
"jasmine-core": "2.5.2",
"jasmine-spec-reporter": "2.5.0",
"karma": "1.2.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.0.2",
"karma-remap-istanbul": "^0.2.1",
"protractor": "~4.0.13",
"ts-node": "1.2.1",
"tslint": "^4.3.0",
"typescript": "~2.0.3"
}
}

最佳答案

只是想用一个对我有用的答案来更新这篇旧帖子:how to publish to github pages?

有一个新的 Angular cli 命令可以推送到 gh-pages,旧的不再有效。所以你必须 install the new command ,构建项目,然后执行推送命令。

关于javascript - 如何将 Angular 2 App 部署到 Github Pages?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42688580/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com