我正在从角度cli启动器构建我的角度应用程序 . 下面的错误中提出了这个问题 .
C:\ Users \ Afropepe \ Desktop \ development \ buy-ticket \ node_modules \ @angular \ cli \ models \ config \ config.js:76抛出新的InvalidConfigError(common_tags_1.stripIndent ^ InvalidConfigError:解析'C:\ Users \ Afropepe \ Desktop \ development \ buy-ticket.angular-cli.json'失败 . 确保文件是有效的JSON . 错误:意外的令牌]在JSON的位置535 InvalidConfigError(C:\ Users \ Afropepe \ Desktop \ development \ buy- ticket \ node_modules \ @angular \ cli \ models \ config \ config.js:11:9)在Function.fromConfigPath(C:\ Users \ Afropepe \ Desktop \ development \ buy-ticket \ node_modules \ @angular \ cli \ models \ config \ config.js:76:19)在Object的Function.fromProject(C:\ Users \ Afropepe \ Desktop \ development \ buy-ticket \ node_modules \ @angular \ cli \ models \ config.js:88:46) . (C:\ Users \ Afropepe \ Desktop \ development \ buy-ticket \ node_modules \ @angular \ cli \ commands \ build.js:7:35)在Object.Module的Module._compile(module.js:570:32)处位于tryModuleLoad的Module.load(module.js:487:32)中的._extensions..js(module.js:579:10)(module.js:446:1) 2)在Module.require的Function.Module._load(module.js:438:3)(module.js:497:17)
4 回答
请确保名为“.angular-cli.json”的文件包含JSON格式,在我的情况下,我在JSON文件中添加了一些注释,即使在VS编译时,这也是无效的
“资产”:[“资产”],
//“index”:“myindexfile.html”,
“main”:“main.ts”,
请确保您的文件具有正确的JSON格式
我得到的错误如下:
当我尝试在scripts文件中的angular-cli.json中导入时,我遇到了一些错误
后
因此,当一个库需要在其之前包含另一个库时,可能会出现此问题 .
angular-cli.json Content:
在.angular-cli.json / angular-cli.json里面只是 remove ////"index": "index.html" ,因为它不会考虑作为注释而抛出一些异常 .
Correct Output:
我有同样的错误,通过替换新的angular-cli.json并重新配置来解决 .