Skip to content

4.3.1 ionic serve throws useless error when ionic.config.json is malformed #3740

Description

@josh-m-sharpe

Description:
I updated to the latest (4.3.1 as of this writing) ionic this morning and started getting this error:

ionic serve -b -c
[ERROR] Sorry! ionic serve can only be run in an Ionic project directory.

        If this is a project you'd like to integrate with Ionic, create an ionic.config.json file.
Error: pid 15830 exit 1

... so I looked at this here file:

$ cat ionic.config.json
{
  "v2": true,
  "typescript": true
}

Looks there to me! Off to the land of googloverflow!

... after some googlin and stack overflowin and source code readin and trial and errorin I finally deduced that ionic.config.json requires a name attribute. Even if it's an empty string. So, adding "name": "" to the file solves. the. problem. 🎉 Makes sense.

Additionally, there is no mention of which attributes are or are not required in the official docs: https://ionicframework.com/docs/cli/configuring.html.

Steps to Reproduce:

echo {} > ionic.config.gsub
ionic serve

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions