解析angular-cli.json失败 [英] Parsing angular-cli.json failed

查看:111
本文介绍了解析angular-cli.json失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Angular CLI上开始投放服务时遇到以下错误.

I'm running into the following error when starting serve on Angular CLI.

解析angular-cli.json失败.请确保您的angular-cli.json是有效的JSON.
Error: SyntaxError: Unexpected token in JSON at position 0

我已经用检查器检查了json文件,作为我在这里发现的其他问题的技巧,它完全可以正常运行.我正在使用Visual studio RC 2017编辑JSON,以将引导程序添加为样式.注释掉添加的样式也会导致相同的错误.因此,似乎VS2017一旦触及JSON就会出错.

I've checked the json file with a checker served as a tip in other questions I found here and it comes up fully ok. I'm using Visual studio RC 2017 to edit the JSON to add bootstrap as a style. Commenting out the added style also results in the same error. So it seems as soon as VS2017 touches the JSON it goes wrong.

你们中的任何人都经历过这个问题,或者有解决方案吗?

Any of you experienced this, or have a solution?

提前谢谢!

Matthias

链接到json文件.当我使用记事本编辑json文件时,它可以正常工作.我认为这是VS2017问题. json文件

edit: link to json file. When I use notepad to edit json file it works fine. It's a VS2017 issue I think. json file

推荐答案

对于Visual Studio 2017社区和angular cli,我通过关闭不带签名的自动检测UTF-8编码并遵循项目编码约定来解决此问题.

For Visual Studio 2017 Community and angular cli, I solved this by turning off Auto-detect UTF-8 encoding without signature and Follow project coding conventions.

转到:工具|选项|文字编辑器|常规:然后取消选中自动检测没有签名的UTF-8编码遵循项目编码约定.

Got to: Tools | Options | Text Editor | General: then uncheck Auto-detect UTF-8 encoding without signature and Follow project coding conventions.

如果在执行此操作之前,您的文件已被VS修改,请从另一个未修改的cli项目中复制一个新文件.

If your file was modified by VS before doing this, copy a new one from another untouched cli project.

这篇关于解析angular-cli.json失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆