我的所有 .json 文件在从 schemastore.azurewebsites.net 加载引用/架构时都存在问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/49056000/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 19:06:32  来源:igfitidea点击:

All of my .json files have problems loading reference/schema from schemastore.azurewebsites.net

jsonvisual-studio-code

提问by kjw

I'm working in VS Code and started getting this error yesterday. All of my json files have this error, not just a few. If I remember right there was an update to the program yesterday or the day before. Did the update break something or reset a setting that I forgot I had set?

我正在 VS Code 中工作,昨天开始收到此错误。我所有的json文件都有这个错误,不仅仅是几个。如果我没记错的话,昨天或前一天对程序进行了更新。更新是否破坏了某些东西或重置了我忘记设置的设置?

When looking this up, people are talking about downloading the schema and using it locally, but I would prefer not to have to do that and would instead like to find out why this broke?

在查找时,人们正在谈论下载模式并在本地使用它,但我宁愿不必这样做,而是想找出为什么会失败?

I am using a proxy, but as far as I know that hasn't changed. Here's the exact error I'm getting.

我正在使用代理,但据我所知没有改变。这是我得到的确切错误。

Problems loading reference 'https://schemastore.azurewebsites.net/schemas/json/package.json': Unable to load schema from 'https://schemastore.azurewebsites.net/schemas/json/package.json': Unable to connect to https://schemastore.azurewebsites.net/schemas/json/package.json. Error: connect ECONNREFUSED 168.62.224.13:443

加载参考“ https://schemastore.azurewebsites.net/schemas/json/package.json”的问题:无法从“ https://schemastore.azurewebsites.net/schemas/json/package.json”加载架构:无法连接到https://schemastore.azurewebsites.net/schemas/json/package.json。错误:连接 ECONNREFUSED 168.62.224.13:443

采纳答案by Aman Saxena

Open User settings of visual studio code through the command palette:

通过命令面板打开 Visual Studio 代码的用户设置:

  1. Press F1
  2. Type user settings.
  3. Select Preferences:Open User Settingsfrom drop down
  4. Put below code and modify accordingly
  1. F1
  2. 键入user settings
  3. Preferences:Open User Settings从下拉菜单中选择
  4. 把下面的代码并相应地修改
"http.proxy": "http://username:password@hostname:port/",
"http.proxyAuthorization": null,
"http.proxyStrictSSL": true
"http.proxy": "http://username:password@hostname:port/",
"http.proxyAuthorization": null,
"http.proxyStrictSSL": true

enter image description here

在此处输入图片说明

回答by Rafael Medeiros

I'm behind my company's proxy which I don't know the details because it's everything automatic, and this problem have bug me for some time.

我支持我公司的代理,我不知道细节,因为一切都是自动的,这个问题困扰了我一段时间。

I'm not sure whether this is an universal solution but according to this issue, the http.proxySupport setting is defaulting to "override". I turn this setting off and the errors disappeared.

我不确定这是否是通用解决方案,但根据此问题,http.proxySupport 设置默认为“覆盖”。我关闭此设置,错误消失了。

    "http.proxySupport": "off"

回答by kushal.8

I was facing following issue with Angular 6:

我在 Angular 6 中面临以下问题:

Problems loading reference 'https://schemastore.azurewebsites.net/schemas/json/package.json': Unable to load schema from 'https://schemastore.azurewebsites.net/schemas/json/package.json': Unable to connect to https://schemastore.azurewebsites.net/schemas/json/package.json. Error: unable to get local issuer certificate

加载参考“ https://schemastore.azurewebsites.net/schemas/json/package.json”的问题:无法从“ https://schemastore.azurewebsites.net/schemas/json/package.json”加载架构:无法连接到https://schemastore.azurewebsites.net/schemas/json/package.json。错误:无法获得本地颁发者证书

I added following properties at the end of the User Settings File and worked for me:

我在用户设置文件的末尾添加了以下属性并对我来说有效:

"http.proxy": "",
"http.proxyAuthorization": null,
"http.proxyStrictSSL": false

回答by nathansantanna

Well i didnt like the idea to set "http.proxyStrictSSL": false, so i started searching, and i found this Issueon SchemaStore site from azure. After seeing this i concluded that my proxy was getting some problem with the certificate and authentication. What i did was change all "https" to "http" in the following session of package.json file(Mine was on this path: C:\Program Files\Microsoft VS Code\resources\app\extensions\typescript-basics\package.json).

好吧,我不喜欢设置“http.proxyStrictSSL”的想法:false,所以我开始搜索,我在 SchemaStore 站点上从 azure找到了这个 问题。看到这一点后,我得出结论,我的代理在证书和身份验证方面遇到了一些问题。我所做的是在 package.json 文件的以下会话中将所有“https”更改为“http”(我的在此路径上:C:\Program Files\Microsoft VS Code\resources\app\extensions\typescript-basics\package .json)。

"jsonValidation": [
  {
    "fileMatch": "tsconfig.json",
    "url": "http://schemastore.azurewebsites.net/schemas/json/tsconfig.json"
  },
  {
    "fileMatch": "tsconfig.json",
    "url": "./schemas/tsconfig.schema.json"
  },
  {
    "fileMatch": "tsconfig.*.json",
    "url": "http://schemastore.azurewebsites.net/schemas/json/tsconfig.json"
  },
  {
    "fileMatch": "tsconfig.*.json",
    "url": "./schemas/tsconfig.schema.json"
  },
  {
    "fileMatch": "typings.json",
    "url": "http://schemastore.azurewebsites.net/schemas/json/typings.json"
  }
]

回答by Lokeshwaran Sivakumar

please follow the step below to solve this problem:

请按照以下步骤解决此问题:

  1. Open the folder where package.jsonfile present
  2. Type npm installfrom cmd
  3. restart VS code or any IDE that you use.
  1. 打开package.json文件所在的文件夹
  2. 键入npm install从CMD
  3. 重新启动 VS 代码或您使用的任何 IDE。

回答by Lucas Fowler

After banging my head against this for longer than I care to admit, I just needed to add the proxyAuthorizationvalue for my Base64 encoded credentials, and did not need the proxyor proxyStrictSSLvalues.

在我对此进行了比我愿意承认的时间更长的时间之后,我只需要proxyAuthorization为我的 Base64 编码凭据添加值,而不需要proxyorproxyStrictSSL值。

I already had my proxy correctly configured in my environment variables. It only has the domain and port, not my credentials, ex. "HTTP_PROXY" "http://example.com:port/".

我已经在我的环境变量中正确配置了我的代理。它只有域和端口,没有我的凭据,例如。“HTTP_PROXY”“ http://example.com:port/”。

I used this C# code in LINQPad to get the proxyAuthorizationvalue from my credentials:

我在 LINQPad 中使用此 C# 代码proxyAuthorization从我的凭据中获取值:

var pw = "[email protected]:password";
var base64Encoded = Convert.ToBase64String(Encoding.UTF8.GetBytes(pw));
base64Encoded.Dump();

This is what I have in my user settings.json, using the encoded string from the above code dump.

这就是我在我的 user 中所拥有的settings.json,使用来自上述代码转储的编码字符串。

"http.proxyAuthorization": "BASE64_ENCODED_VALUE"

Note:I believe that if I didn't need the full username with email address in the credentials for our proxy to let me out, I could have used an above solution. But since I did, this was the only way I could get it to work.

注意:我相信,如果我不需要代理凭据中包含电子邮件地址的完整用户名来让我离开,我可以使用上述解决方案。但既然我这样做了,这是我让它工作的唯一方法。

回答by desoga

Just close your VsCode Editor and open it again. That should fix the error.

只需关闭您的 VsCode 编辑器并再次打开它。那应该修复错误。

回答by micksatana

If you still want the proxy support to work, just disable the proxyStrictSSL. Don't need to adjust other settings.

如果您仍然希望代理支持工作,只需禁用proxyStrictSSL. 不需要调整其他设置。