Search code examples
cordovaionic-frameworkyeoman

How to fix "ReferenceError : ionic is not defined" when I run command `ionic serve --lab`?


I have created a Ionic project in Yeoman. I have selected the option localhost when ionic serve command showed multiple address. But when I am running the app, it's showing error on the console

   ReferenceError : ionic is not defined

And this is the complete process which I am following -

   Running live reload server: http://localhost:35729
   Watching : [ 'www/**/*', '!www/lib/**/*' ]
   Running dev server: http://localhost:8100
   Ionic server commands, enter:
   restart or r to restart the client app from the root
   goto or g and a url to have the app navigate to the given url
   consolelogs or c to enable/disable console log output
   serverlogs or s to enable/disable server log output
   quit or q to shutdown the server and exit

   ionic $ c
   Console log output: enabled
   Loading: /?restart=998712
   ionic $ 0     129599   error    ReferenceError: ionic is not defined,       http://localhost:8100/?ionicplatform=ios, Line: 103
    0     129653   error    ReferenceError: ionic is not defined,   http://localhost:8100/?ionicplatform=android, Line: 103

I am unable to understand why this error is flashing on the console. Ionic is installed on my system and I have tested it running using ionic command. Here is the screenshot of error which I am getting. I have also checked the ionic.config file in system and its server address is already there in the following manner

  "ionicServeAddress": "localhost"

Solution

  • You have solve your issues in two ways.

    1. Deleting node_modules and then running npm update
    2. Reinstalling gulp (But you should installed global)

      npm install -g gulp