几个星期前,我能够将使用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和节点js是最新的,错误表明问题出在我的package.json文件中.
我的终端继续呈现我的程序的所有五个块,但是没有链接可以关注该网站.有什么办法可以解决这个问题吗?我完成了我的网站,只需要一个地方来托管它.作为初学者,我很失落,所以请指出任何明显的错误或遗漏信息.
的package.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"
}
}
最佳答案 只想更新这篇老帖子,并在这篇SO帖子上找到了一个对我有用的答案:
how to publish to github pages?
有一个新的角度cli命令推送到gh页面,旧的不再有效.所以你必须要install the new command,构建项目,然后执行push命令.