Ionic Serve fails with error on CLI 3.0.0

After updating to Ionic CLI 3.0.0 and running IONIC SERVE from a project folder I get the error:

TypeError: Cannot read property ‘includes’ of undefined

However, if I run just IONIC at the root and then go the the project folder and run IONIC SERVE it works.

Before updating to the latest CLI version, this was working perfectly. Any ideas?

What does this mean?

In terminal if I type ionic, then go to a project folder and type ionic serve the app runs in the browser.

However, if I first go to the project folder and type ionic serve it comes up with the error.

So, now every time I go to Terminal, I have to type ionic first before going into any project folder otherwise the ionic serve statement comes up with the error.

I only have to do it the once but in previous releases it was not necessary to run ionic first before doing anything else.

What is the output when you run ‘ionic’ first outside the project?

Please post your ‘ionic info’ and ‘packages.json’ so we learn a bit about your environment.

Last login: Sat May 13 07:38:07 on ttys000
Simons-MBP:~ simontowell$ cd leaderboard2
Simons-MBP:leaderboard2 simontowell$ ionic serve
TypeError: Cannot read property 'includes' of undefined

Simons-MBP:leaderboard2 simontowell$ ionic info
TypeError: Cannot read property 'includes' of undefined

Simons-MBP:leaderboard2 simontowell$ cd ..
Simons-MBP:~ simontowell$ ionic
   _             _
  (_)           (_)
   _  ___  _ __  _  ___
  | |/ _ \| '_ \| |/ __|
  | | (_) | | | | | (__
  |_|\___/|_| |_|_|\___|  CLI 3.0.0


  Usage:

    $ ionic <command> [arguments] [options]
    $ ionic <command> --help (for command details)

  Global Commands:

    docs ................ Open the Ionic documentation website
    info ................ Print system/environment info
    login ............... Login with your Ionic ID
    signup .............. Create an Ionic account
    start ............... Create a new project
    telemetry ........... Opt in and out of telemetry

  Project Commands:

    You are not in a project directory.

  Options:

    --verbose ........... Verbose output for debugging
    --help .............. Show help for provided command

Simons-MBP:~ simontowell$ cd leaderboard2
Simons-MBP:leaderboard2 simontowell$ ionic info

global packages:

    @ionic/cli-utils : 1.0.0
    Ionic CLI        : 3.0.0

local packages:

    @ionic/app-scripts              : 1.3.7
    @ionic/cli-plugin-ionic-angular : 1.0.0
    Ionic Framework                 : ionic-angular 2.2.0

System:

    Node       : v7.2.1
    OS         : macOS Sierra
    Xcode      : Xcode 8.3.2 Build version 8E2002 
    ios-deploy : 1.9.0 
    ios-sim    : 5.0.13 

Simons-MBP:leaderboard2 simontowell$ ionic info

global packages:

    @ionic/cli-utils : 1.0.0
    Ionic CLI        : 3.0.0

local packages:

    @ionic/app-scripts              : 1.3.7
    @ionic/cli-plugin-ionic-angular : 1.0.0
    Ionic Framework                 : ionic-angular 2.2.0

System:

    Node       : v7.2.1
    OS         : macOS Sierra
    Xcode      : Xcode 8.3.2 Build version 8E2002 
    ios-deploy : 1.9.0 
    ios-sim    : 5.0.13

From this point ionic serve will now work.

Wow, interesting. Try running ionic info --verbose and ionic --verbose the first time and see if this gives you different output.

I would suggest completely blowing your node install away and installing a new one managed by nvm. Something seems to be wonky with your path.

I’ve got the same issue. Sometimes ionic serve doesn’t give any error or display anything and just exits. All this started when I upgraded ionic cli to 3.0.0 using sudo npm install -g ionic.

I had to downgrade to make things work. I did sudo npm install -g ionic@2.2.3 and everything works fine now.

I downgraded back to an earlier version of the cli and that works fine, so something not quite working on v3.

Well, if you all jus downgrade back to the last working version Ionic won’t be able to fix anything and you will be left behind :wink:

I have the same problem after upgrading to 3.0.0 (. If I run ionic command in project folder error message appears.

I must execute ionic command in other folder, then go to project folder again and ionic command works, if I execute ionic serve, it works, after a while I stop it and ionic command does not work again (same procedure to get it to work again).

global packages:

@ionic/cli-utils : 1.1.2
Ionic CLI        : 3.1.2

System:

Node       : v6.10.3
OS         : Windows 10
Xcode      : not installed
ios-deploy : not installed
ios-sim    : not installed