Ionic vue uninstall : Bad project type: undefined

Hi, after first install of ionic with vue and followed instructions from " Build your way with TypeScript or JavaScript" I got an error to compile from VSC.
Because resolving this problem was too long and complicated, I prefer uninstall and reinstall Ionic project.
After that get this error : Bad project type: undefined
and this too : Could not determine project type (project config: ./ionic.config.json)
I tried everything on Ionic, GitHub or stack overflow .
For each command line I get this error.

Currently I have no more ionic project. Only Ionic CLI, Cordova and node
Before I tried to create a new ionic.config.json file.

Could you please help me to resolve this problem ?

How are you creating the Ionic app? The easiest way is going to be by using the ionic start command via the Ionic CLI.

% ionic start
Bad project type: undefined

I tried to start over, but I have always this error.

Can you give me a little bit more information about your setup?

  • What version of the Ionic CLI are you using (run: ionic -v)
  • What version of Node are you using (run: node -v)
  • What operating system are you using?

I must wait 12min for each answer !

% ionic -v
[WARN] Could not determine project type (project config: ./ionic.config.json).

   - For @ionic/angular projects, make sure @ionic/angular is listed as a
   dependency in package.json.
   - For Ionic 2/3 projects, make sure ionic-angular is listed as a
   dependency in package.json.
   - For Ionic 1 projects, make sure ionic is listed as a dependency in
   Alternatively, set type attribute in ./ionic.config.json to one of:
   angular, react, vue, ionic-angular, ionic1, custom.
   If the Ionic CLI does not know what type of project this is, ionic build,
   ionic serve, and other commands may not work. You can use the custom
   project type if that's okay.

Bad project type: undefined

% node -v

Sounds like something is not right with the Ionic CLI install. Try uninstalling the CLI:

npm uninstall -g ionic @ionic/cli

And then re-install the CLI:

npm install -g @ionic/cli@latest

If that does not fix the issue, can you let me know what operating system you are using?

% npm uninstall -g ionic @ionic/cli
removed 233 packages in 3.139s

% npm install -g @ionic/cli@latest
/Users/NameUser/.npm-global/bin/ionic โ†’ /Users/NameUser/.npm-global/lib/node_modules/@ionic/cli/bin/ionic

  • @ionic/cli@6.17.1
    added 212 packages from 157 contributors in 19.529s

    โ”‚ โ”‚
    โ”‚ New major version of npm available! 6.14.15 โ†’ 8.0.0 โ”‚
    โ”‚ Changelog: Release v8.0.0 ยท npm/cli ยท GitHub โ”‚
    โ”‚ Run npm install -g npm to update! โ”‚
    โ”‚ โ”‚

% ionic start
Bad project type: undefined

I also tried to uninstall and re-install completely node, npm and vue

It sounds like you have a bad ionic.config.json file somewhere in the path.

Can you provide the output of running DEBUG=* ionic start? This should tell you where that bad config file is.

Thanks, I know that my ionic.config.json doesnโ€™t exist.
I tried to uninstall and install again node to resolve that .

% DEBUG=* ionic start

ionic:lib Terminal info: { ci: false, shell: โ€˜/bin/zshโ€™, tty: true, windows: false } +0ms

ionic:lib CLI global options: { _: [ โ€˜startโ€™ ], help: null , h: null , verbose: null , quiet: null , interactive: true, color: true, confirm: null , json: null , project: null , โ€˜โ€“โ€™: } +4ms

ionic:lib:project Project details: { context: โ€˜appโ€™, type: undefined, errors: [ โ€˜ERR_MISSING_PROJECT_TYPEโ€™ ], configPath: โ€˜/Users/NameUser/ionic.config.jsonโ€™ } +0ms

Bad project type: undefined

Sorry, what I meant was there is another ionic.config.json file somewhere on your machine that ionic start is picking up.

It looks like there is a bad ionic.config.json file at /Users/NameUser/ionic.config.json. Can you delete that file then try running DEBUG=* ionic start again?

You are my hero !
It works again.

Also must I delete this two file in the same directory, package-lock.json and package.json ?

1 Like

Glad the issue is resolved! Yeah, it should be fine to delete those two files.

For anyone else running into this issue:

If you are running into a Bad project type: undefined error, then you likely have a bad ionic.config.json file somewhere in your project path that ionic start is picking up. Removing this configuration file should fix the issue:

Run DEBUG=* ionic start which will show you where the bad config file is:

configPath: '/Users/TestUser/tmp/ionic.config.json'

In this case, the bad file is at '/Users/TestUser/tmp/ionic.config.json'. Delete the ionic.config.json file and re-run ionic start.