2016-12-30 37 views

回答

0

你的角cli.json有一個JSON的錯誤,你忘了一個逗號:

"styles": [ 
    "app/core/preloader/preloader.scss", 
    "styles.scss" 
    "../node_modules/bootstrap/dist/css/bootstrap.min.css" 
    ], 

應該

"styles": [ 
    "app/core/preloader/preloader.scss", 
    "styles.scss", 
    "../node_modules/bootstrap/dist/css/bootstrap.min.css" 
    ] 

爲了確保你的json是有效的,你可以把它放在json validator;

+0

我在json文件中的styles.css中添加了逗號,現在我無法在構建中看到錯誤,但我無法在瀏覽器中看到輸出vie。 –

2

有一個在你的JSON(第22行)缺少逗號:

"styles": [ 
    "app/core/preloader/preloader.scss", 
    "styles.scss" <---- 
    "../node_modules/bootstrap/dist/css/bootstrap.min.css" 
], 

有效的JSON:

{ 
    "project": { 
    "version": "1.0.0-beta.24", 
    "name": "ki-angular2-spa-form0" 
    }, 
    "apps": [ 
    { 
     "root": "src", 
     "outDir": "dist", 
     "assets": [ 
     "assets", 
     "favicon.ico" 
     ], 
     "index": "index.html", 
     "main": "main.ts", 
     "test": "test.ts", 
     "tsconfig": "tsconfig.json", 
     "prefix": "app", 
     "mobile": false, 
     "styles": [ 
     "app/core/preloader/preloader.scss", 
     "styles.scss", 
     "../node_modules/bootstrap/dist/css/bootstrap.min.css" 
     ], 
     "scripts": [ 


     "app/core/preloader/preloader.ts", 
     "vendor.ts" 
     ], 
     "environments": { 
     "source": "environments/environment.ts", 
     "dev": "environments/environment.ts", 
     "prod": "environments/environment.prod.ts" 
     } 
    } 
    ], 
    "addons": [], 
    "packages": [], 
    "e2e": { 
    "protractor": { 
     "config": "./protractor.conf.js" 
    } 
    }, 
    "test": { 
    "karma": { 
     "config": "./karma.conf.js" 
    } 
    }, 
    "defaults": { 
    "styleExt": "css", 
    "prefixInterfaces": false, 
    "inline": { 
     "style": false, 
     "template": false 
    }, 
    "spec": { 
     "class": false, 
     "component": true, 
     "directive": true, 
     "module": false, 
     "pipe": true, 
     "service": true 
    } 
    } 
} 

您可以使用JSONLint驗證您的JSON和發現的錯誤。

相關問題