I just finished updating my version of the DAML SDK to the latest and when I attempt to login to the Navigator. This is when using the create daml app, I get the following error message:
Unknown error Syntaxerror: unexpected token E in JSON at position 0
I could not find the navigator.log I apologize not sure where to find it
Sandbox.log
12:41:38.374 [sandbox-akka.actor.default-dispatcher-5] INFO akka.event.slf4j.Slf4jLogger - Slf4jLogger started
12:41:43.440 [pool-1-thread-4] INFO c.d.p.apiserver.LedgerApiServer - Listening on localhost:6865 over plain text.
12:41:43.448 [pool-1-thread-2] INFO com.daml.platform.sandboxnext.Runner - Initialized sandbox version 1.7.0 with ledger-id = create-daml-app-sandbox, port = 6865, dar file = List(.daml\dist\create-daml-app-0.1.0.dar), time mode = wall-clock time, ledger = in-memory, auth-service = AuthServiceWildcard$, contract ids seeding = strong
Hi @davidk, I saw you posted the same question on Stackoverflow. Same request as I left there, we need a bit more information to diagnose this:
Could you share the command you use to start the Navigator, and the log outputs? By default they’d be in navigator.log and sandbox.log . Also, what URL do you get that error on? You could also try opening your browser’s developer console and checking whether there are any requests with error codes and if so, share those here.
The type of error unexpected token E in JSON at position 0 tends to occur when a webapp calls an endpoint which it expects to return a JSON payload, but instead it gets something different like a HTML error page. My best guess is that there was a port mismatch and something other than the Navigator was running on the port that was being called.
I got the same issue because I was running an older version of Java (i.e. 8), but daml requires 11. It’s a little confusing that we get a JS error because npm start does not print out an error message and happily starts up. It’s nice if user errors are detected and useful messages are printed rather than allowing an app to run in an inconsistent state / badly configured environment.
Would be nice if
npm start refuses to start and prints an error message if daml is not running as expected, this would have prevented the above user hitting this issue and also myself.
Digital Asset implement version handshakes so that meaningful error messages are produced.
daml start exits rather than continuing to run when the java version is incorrect
Anyway to fix I had to do the following:
brew install java11
This doesn’t seem to do anything:
sam@MacBook-Pro:/Users/sam/src/create-daml-app ls /Library/Java/JavaVirtualMachines/
jdk1.8.0_192.jdk