Fresh ionic react project got [ERROR] Invalid project type: react-vite (project config: .\ionic.config.json)

  1. I create new project with following command:
ionic start MyApp blank --type=react
  1. I opened this project on VSCode
  2. I use Ionic’s VS Code extension to run a web server like photo below

  1. I got this from output window:
[Ionic] Running on Web...
> npx ionic serve --external
[ERROR] Invalid project type: react-vite (project config: .\ionic.config.json).
        
        Project type must be one of: angular, react, vue, ionic-angular, ionic1, custom
Bad project type: undefined
[error] node "c:\Users\myuser\.vscode\extensions\ionic.ionic-1.34.1\node_modules\@ionic\cli\bin\ionic" serve --external Failed
[error] Web Failed.

This also happened with Project > Build and everything.

Here is my ionic info:

Ionic:

   Ionic CLI       : 7.0.0 (C:\Users\teerasejjiraphatchan\AppData\Roaming\npm\node_modules\@ionic\cli)
   Ionic Framework : @ionic/react 7.0.0

Capacitor:

   Capacitor CLI      : 4.7.3
   @capacitor/android : not installed
   @capacitor/core    : 4.7.3
   @capacitor/ios     : not installed

Utility:

   cordova-res : not installed globally
   native-run  : 1.7.2

System:

   NodeJS : v18.15.0 (C:\Program Files\nodejs\node.exe)
   npm    : 9.5.0
   OS     : Windows 10

Hi @teerasej,

I also get same error and I believe this issue is related to the vscode extension. (I just open an issue on Ionic vscode extension’s GitHub: bug: [ERROR] Invalid project type: react-vite · Issue #101 · ionic-team/vscode-extension · GitHub)

Currently, I just manually type the npx ionic serve --external command in the terminal as a workaround.

Thank you, @jonz94. I also confirmed that using the command in the terminal directly doesn’t cause any problem, But the ionic’s vscode extension did.

The error has been resolved since Ionic’s VS code extension 1.35.0

1 Like

This error still occurs on Ionic VS Code Extension v1.49.0.

Here’s the error message I get when I try to run the app on Android:

[ERROR] Invalid project type: react-vite (project config: ./ionic.config.json).
        
        Project type must be one of: angular, ionic-angular, ionic1, custom, react, vue
Bad project type: undefined

My project is a react-vite project btw.