We should move checkError to the top of the function.
Or we may only get below error message if the makefile goes wrong.
Uncaught Error: ENOENT, no such file or directory '/Users/tuangeorge/code/gaia/profile-debug/settings.json'