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

查看:35
本文介绍了解析 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.
错误:SyntaxError:JSON 中位置 0 处出现意外标记

Parsing angular-cli.json failed. Please make sure your angular-cli.json is valid 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?

提前致谢!

马蒂亚斯

链接到 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 Community 和 angular cli,我通过关闭 Auto-detect UTF-8 encoding without signature 并遵循项目编码约定解决了这个问题.

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天全站免登陆