2017-03-09 142 views
3

几周前,我能够将一个使用Angular Cli工具制作的应用程序发布到Github Pages,但现在当我尝试使用命令ng github-pages: deploy时,出现错误:The specified command github-pages:deploy is invalid.。这github thread表明命令已被最近被移除,并petersgiles建议遵循这些指导方针,而不是发布网页:如何将Angular 2应用程序部署到Github页面?

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 

我跟着这些指示,但得到的错误:Failed at the [email protected] deploy script 'ng build -sm -ec -bh /aboutme/ & ngh --silent=false'.我NPM和节点JS是最新的TO-日期,错误表明问题出在我的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" 
    } 
} 

回答

0

我怀疑ngh --silent=false抛出一个错误。在这个答案时用于运行详细输出的angular-cli-pages的命令是ngh --no-silent

如果你想更新你的部署脚本,请看angular-cli-pages doc来查看构建和部署的命令:

> ng build --prod --base-href "https://USERNAME.github.io/REPOSITORY/"
> ngh --no-silent

相关问题