尝试运行应用程序后,会出现此错误:
解析angular-cli.json失败。请确保你的 angular-cli.json是有效的JSON。错误:SyntaxError:意外的字符串 在JSON第498位
我的申请表 git回购:https://github.com/kishore1288/Ki-Ng2-SPA-Form
答案 0 :(得分: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并查找错误。
答案 1 :(得分:0)
你的angular-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;