sennder
sennder

Reputation: 111

Visual Studio Code - Type Script - Unable to load tsconfig.json and packages.json schemas

I'm working on an Angular front end in Visual Studio Code for an app with a C# windows service back end. After spending a few days on the back end without touching the front end, I found that Visual Studio Code would no longer automatically recompile my typescript code every time I saved. Instead, I would have to ctrl+c out of the process and run "npm start" again.

I ensured that compileOnSave was set to true in my tsconfig.json. In doing so, I notice a warning:

Problems loading reference 'http://json.schemastore.org/tsconfig': Unable to load schema from 'http://json.schemastore.org/tsconfig': Unable to to connect to http://json.schemastore.org/tsconfig. Error: getaddrinfo ENOTFOUND json.schemastore.org json.schemastore.org:80

I noticed a similar warning for packages.json. I'm able to load the schema on the links on Google Chrome.

What could be a possible fix? Could I download the schema and load it in Visual Studio Code manually?

Upvotes: 8

Views: 22063

Answers (4)

Ben1440
Ben1440

Reputation: 41

just follow these simple steps

  1. click on the Settings icon at the bottom left of your vscode
  2. search for JSON
  3. you should see the schema download, it should be enabled
  4. just turn it off

This worked for me. The first image was a before

The second image shows the text editor after

Upvotes: 4

maltoze
maltoze

Reputation: 737

Update:

Seems a network issue for me. When I set Http: proxy correctly it disappeared and json schema works well.

httpproxysettings

jsonschemaworkfine


Go to "Settings" > "JSON" > "Schema Download" and disabled it.

That's worked for me.

Upvotes: 5

guest_user
guest_user

Reputation: 81

For me it wasn't the proxy blocking, but trusted domain list in VSCode.

Go to "Manage trusted domains" on Command Palette and add required url. Here we can add "http://json.schemastore.org"

This is whitelist for VSCode, as a security feature, stopping it running code from anywhere from internet.

Upvotes: 8

sennder
sennder

Reputation: 111

The solution, as pointed out by @Matt Bierner in the comment above, is to set the "$schema" key to direct to a local schema file (which can be downloaded from the address in the error).

The problem seems to be caused by a web proxy. Why it showed up now is still unknown.

Upvotes: 3

Related Questions