Just using the simple ‘build’ command but getting JSON error, but it does not provide a name for which file! All I get are the printout between the dashed lines:
[11:09:28] ionic-app-scripts 0.0.47
[11:09:28] build dev started …
[11:09:28] clean started …
[11:09:28] clean finished in less than 1 ms
[11:09:28] copy started …
[11:09:28] transpile started …
[11:09:32] transpile finished in 4.37 s
[11:09:32] webpack started …
[11:09:33] copy finished in 4.75 s
[11:09:42] webpack finished in 9.54 s
[11:09:42] sass started …
[11:09:44] sass finished in 1.64 s
[11:09:44] build dev finished in 15.60 s
Error: Unexpected token in JSON at position 0
Checked the usual files: package.json, tsconfig.json etc… but not spotting any issues.
Is there a way to get build tool to be a bit more friendly? Relatively new to ionic development. Thanks.
Thanks saintsatplay - posting this question is a last desperate attempt as I’m out of ideas and have spent the last two days googling with no success.
The code base is quite big for this app and it would be impossible to back track everything I’ve done. The application was developing fine until a couple of days ago as I noticed my changes were not getting compiled into new versions. Since then I’ve uninstall and reinstalled pretty much everything (cordova, ionic, node etc…) finally got ‘ionic serve’ to show new changes in code but this one is a killer as it does not show which JSON file is the problem!
I’m guessing a standard module JSON file being corrupted somehow by my installations but impossible to know which one when there are thousands of them??!!
In Ionic serve can you use the Browser inspector tools to analyse the network requests and see what responses are being returned for http requests? This might help narrow down if there is JSON not able to be returned properly (I.e. a malformed response) or not at all - which is what might be causing your app to choke on build process.
Alternatively, If you’re using a CVS like Git or BitBucket for example you could try rolling back to different versions and seeing whether certain files have made a difference.
Other than that all I can recommend is creating a new app and re-creating each file (pasting the contents from the old into the new) and testing one at a time (OR up to the last point where you know it was working and then diagnose which amendments afterwards cause the issue).
I get that you’ve got a large codebase to work with - and it ain’t easy - but those would be my best suggestions for what they’re worth.
[22:58:44] ionic-app-scripts 0.0.47
[22:58:44] build dev started …
[22:58:44] clean started …
[22:58:44] clean finished in 15 ms
[22:58:44] copy started …
[22:58:44] transpile started …
[22:59:03] transpile finished in 19.52 s
[22:59:04] webpack started …
[22:59:04] copy finished in 20.45 s
[22:59:20] webpack finished in 16.68 s
[22:59:20] sass started …
[22:59:24] sass finished in 3.52 s
[22:59:24] build dev finished in 39.80 s
Having the same problem. It appeared after computer restarted while running ionic run command. I managed to get ionic serve working again by deleting C:\Users\Diego.ionic\ionic.config file which was corrupted. However until now I am not able to get ionic run or ionic build working again
Have you resolved Error: Unexpected token in JSON at position 0 issue while build?
I’m facing same problem.
If you have any solution please reply.
Thanks.