others-how to solve Error loading syntax file 'Packages/JavaScript/JSON.tmLanguage': Unable to open Packages/JavaScript/JSON.tmLanguage when trying to format json in sublime text?
1. Purpose
In this post,I would demonstrate how to solve Error loading syntax file “Packages/JavaScript/JSON.tmLanguage”: Unable to open Packages/JavaScript/JSON.tmLanguage when trying to format json in sublime text.
The error detail is:
Error loading syntax file "Packages/JavaScript/JSON.tmLanguage": Unable to open Packages/JavaScript/JSON.tmLanguage
Just as the following picture shows:
2. Solution
2.1 How to trigger this error?
Just press cmd+shift+p
: then choose pretty json,just as following picture shows:
then you can see this error:
2.2 Some reasons of the error
probable reason #1:
JSON syntax was moved from JavaScript to its own JSON package as it more widely used. Two reasons may cause an error message after upgrading: At least one JSON file is open. As syntax is assigned when opeing a file only, it may have pointed to the old no longer existing syntax definition. A syntax cache file of the old syntax remained in ~/.cache which is referenced by something. It points to a no longer existing syntax definition. Reinstalling the whole application doesn’t help in such situation.
probable reason #2:
I found that if I click on the OK button on the alert dialog box and then close all the open tabs in Sublime Text 3 and then close ST3 and reopen it, the error message no longer comes up.
2.3 My solution
Just close the json files and all other tabs in sublime text.
Then exit sublime text process.
And open sublime again, open the json file and save it as xxx.json.
Finally , test the json format again, it works!
3. Summary
In this post, I demonstrated how to solve Error loading syntax file “Packages/JavaScript/JSON.tmLanguage”: Unable to open Packages/JavaScript/JSON.tmLanguage when trying to format json in sublime text. That’s it, thanks for your reading.