Seemingly random "Uncaught SyntaxError: Unexpected token . "


I sometimes get this error: "Uncaught SyntaxError: Unexpected token . " My app.js is here: My index.html is here:

The issue seems to be randomly occurring. For instance, this same code was running. What I did to make the code break was to remove localStorageService from the controller definition and on reload, the code broke. I have replaced the localStorageService in the controller definition but still the code breaks.

The error in the browser console is:

Uncaught SyntaxError: Unexpected token .
Uncaught Error: [$injector:modulerr]$injector/modulerr?p0=lukaduka-pos&p1=Error:%20[$injector:nomod]$injector%2Fnomod%3Fp0%3Dlukaduka-pos %20%20%20%20)

I am a bit baffled by the Uncaught Error complaint. As you can see from the pastebin, the module definition looks fine.

Anyone with some insights? I am stumped.

Nii Amon


Following along the links in the error report, I landed on this page:$injector/nomod?p0=lukaduka-pos.

The root of the problem is this:
“Module ‘lukaduka-pos’ is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.”

This is my module registration:

angular.module(‘lukaduka-pos’, [‘ionic’, ‘LocalStorageModule’]);

This looks ok to me. Can anyone spot anything wrong here?


Weirder and weirder. I got the code to work now.

What I did was to delete my app.js code and copy and paste the last version of the app.js code from the tutorial. I then edited it to look exactly like my code which wasn’t working. The gist for the new code which is working can be found here: It’s essentially the same as my code which wasn’t working here:

Can anyone spot the differences? I can’t see any significant differences.


The issue is the ; on your very first line angular.module('lukaduka-pos', ['ionic', 'LocalStorageModule']);.


Thanks buddy. Got that fixed!