2017-03-09 144 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

相關問題