How to fix “ ReferenceError : ionic is not defined ” when I run command ionic serve --lab


#1

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 its 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 ionic 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"

Please help me to fix this problem.


#2

When you say ionic is installed on your system, I suppose you mean you did ‘npm install -g ionic’ which installs ionic commands only.
Then you must install ionic in your project, this should have been done by the yeoman generator you used, check with the generator’s doc.