1

I'm having an error with the ionic serve command.I can serve application via npm run ionic:serve.I searched things about this and also adding output of ionic serve --verbose.Please help to get out from this.

ionic info output is this:

cli packages: (C:\Users\DELL\AppData\Roaming\npm\node_modules)

        @ionic/cli-utils  : 1.19.1
        ionic (Ionic CLI) : 3.19.1

    global packages:

        cordova (Cordova CLI) : 8.0.0

    local packages:

        @ionic/app-scripts : 3.1.8
        Cordova Platforms  : windows broken
        Ionic Framework    : ionic-angular 3.9.2

    System:

        Node : v8.4.0
        npm  : 5.3.0
        OS   : Windows 8.1

    Environment Variables:

        ANDROID_HOME : C:\Users\DELL\AppData\Local\Android\sdk;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools

ionic serve --verbose output is this:

[DEBUG] Reason for not using local CLI: LOCAL_CLI_NOT_FOUND
[DEBUG] CLI flags: { interactive: true, confirm: false }
[DEBUG] { cwd: 'C:\\Users\\DELL\\garageApp', local: false, binPath:
        'C:\\Users\\DELL\\AppData\\Roaming\\npm\\node_modules\\ionic\\bin\\ionic', libPath:
        'C:\\Users\\DELL\\AppData\\Roaming\\npm\\node_modules\\ionic\\dist\\index.js' }
[DEBUG] Daemon found (pid: 3040)
Starting app-scripts server: --address 0.0.0.0 --port 8100 --livereload-port 35729 --dev-logger-port 53703 --nobrowser -
Ctrl+C to cancel
[16:53:29]  watch started ...
[16:53:29]  build dev started ...
[16:53:29]  clean started ...
[16:53:29]  clean finished in 88 ms
[16:53:29]  copy started ...
[16:53:30]  deeplinks started ...
[16:53:30]  deeplinks finished in 252 ms
[16:53:30]  transpile started ...
[16:53:47]  transpile finished in 17.42 s
[16:53:47]  preprocess started ...
[16:53:47]  preprocess finished in 5 ms
[16:53:47]  webpack started ...
[16:53:48]  copy finished in 18.51 s
[16:54:15]  webpack finished in 27.23 s
[16:54:15]  sass started ...
Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.
[16:54:20]  sass finished in 5.78 s
[16:54:20]  postprocess started ...
[16:54:21]  postprocess finished in 73 ms
[16:54:21]  lint started ...
[16:54:21]  build dev finished in 51.56 s
[16:54:22]  watch ready in 52.37 s
[16:54:22]  dev server running: http://localhost:8100/

[OK] Development server running!
     Local: http://localhost:8100
     External: http://192.168.1.14:8100
     DevApp: garageApp@8100 on admin


E:\garage-frontend>
Aneri Vala
  • 528
  • 3
  • 11
  • Your application is running check http://localhost:8100 – Melchia Mar 01 '18 at 12:02
  • You can also run `ionic serve` directly from the command line without the `npm run`. But as @Aneri points out, the application is running on port 8100. – Steven Scott Mar 01 '18 at 16:54
  • @StevenScott I'm running the same but with that(ionic serve) command terminate itself and when I open localhost:8100 on browser.I'm not able to see my application whereas when I use npm run ionic:serve at that time I'm getting my Application on browser. – Aneri Vala Mar 09 '18 at 05:58
  • When you go to localhost:8100 &open the debug tool (f12). What do you see in the console? – Melchia Mar 09 '18 at 07:57
  • @Melchia Console is empty and on http://localhost:8100/ all I can see is this This site can’t be reached localhost refused to connect. Search Google for localhost 8100 ERR_CONNECTION_REFUSED – Aneri Vala Mar 09 '18 at 10:22
  • Have you tried http://192.168.1.14:8100 – Melchia Mar 09 '18 at 10:31
  • Yes but not working @Melchia – Aneri Vala Mar 09 '18 at 13:29
  • Honestly I never saw something like this. How come the server stop without any error, unless you quit manually. – Melchia Mar 09 '18 at 13:42
  • I cannot see how this fails either. Have you tried simply starting another basic project and try to see if the web server starts there? A basic template should work and be running. If that works, then simply move your pages and application into it and be running as we do not see an error stopping your server. Could you have a firewall problem? Even with npm run ionic:serve mine continues without a problem. – Steven Scott Mar 09 '18 at 15:37
  • Refer this link https://github.com/ionic-team/ionic-cli/issues/2570 – hrdkisback Mar 14 '18 at 11:23

9 Answers9

0

Looks like your application is already running but not getting opened in a browser tab. You can force ionic to open an application in a particular browser like:-

ionic serve -w chrome (for chrome)

ionic serve -w firefox (for mozila)

Maybe it will help.

Community
  • 1
  • 1
CThakur
  • 136
  • 8
0

ionic serve -d it works, it helps you.

0

Try the below command,

npm run ionic:serve -l

This will work as similar to ionic serve -l

Rajkumar K
  • 1,369
  • 3
  • 9
  • 13
0

May be it will works.. Try below steps

npm install -g ionic@latest

npm install @ionic/app-scripts@latest --save-dev

npm install ionic-angular@latest --save

ionic serve
pushkin
  • 9,575
  • 15
  • 51
  • 95
Pawwa
  • 43
  • 9
0

I have seen this happen sometime when you are running ionic serve on your machine without a valid network connection. Please try when you are connected to a network.

amazeus
  • 106
  • 1
  • 5
0

Try below command hope it will work

  • npm install (in project directory)

  • npm run ionic:serve --verbose

Nemchand
  • 1
  • 1
  • 1
0

Adding c:\windows\system32 to the PATH environment variables solved my issue.

0

In Windows

once open your task manager(press ctrl+Shift+Esc) and stop all the tasks with name node.exe and again run the ionic serve it will work.

Pradeepa
  • 107
  • 4
0

below are the steps are taken to resolve the issue.

check source

  1. CMD run as Administrator and npm uninstall -g ionic cordova
  2. Shutdown the system, not restarted
  3. Start/Boot system after sometime, removed all from TEMP folder.
  4. Installed the latest version of NodeJS as Administrator
  5. Open CMD as Administrator and updated npm install -g npm
  6. npm install -g ionic
  7. npm install -g cordova
  8. After that test, It works fine with any directory.
Chanaka Weerasinghe
  • 5,404
  • 2
  • 26
  • 39