Error :Ionic Serve

D:\ionic\bana>ionic serve

react-scripts start
[react-scripts] D:\ionic\bana\node_modules\react-dev-utils\node_modules\browserslist\node.js:303
[react-scripts] throw new BrowserslistError(
[react-scripts] ^
[react-scripts] Error [BrowserslistError]: D:\ionic\bana contains both browserslist and package.json with browsers
[react-scripts] at D:\ionic\bana\node_modules\react-dev-utils\node_modules\browserslist\node.js:303:15
[react-scripts] at eachParent (D:\ionic\bana\node_modules\react-dev-utils\node_modules\browserslist\node.js:48:18)
[react-scripts] at Object.findConfig (D:\ionic\bana\node_modules\react-dev-utils\node_modules\browserslist\node.js:279:20)
[react-scripts] at Function.loadConfig (D:\ionic\bana\node_modules\react-dev-utils\node_modules\browserslist\node.js:212:37)
[react-scripts] at checkBrowsers (D:\ionic\bana\node_modules\react-dev-utils\browsersHelper.js:45:32)
[react-scripts] at Object. (D:\ionic\bana\node_modules\react-scripts\scripts\start.js:83:1)
[react-scripts] at Module._compile (internal/modules/cjs/loader.js:1133:30)
[react-scripts] at Object.Module._extensions…js (internal/modules/cjs/loader.js:1153:10)
[react-scripts] at Module.load (internal/modules/cjs/loader.js:977:32)
[react-scripts] at Function.Module._load (internal/modules/cjs/loader.js:877:14) {
[react-scripts] browserslist: true
[react-scripts] }

[ERROR] react-scripts has unexpectedly closed (exit code 1).

    The Ionic CLI will exit. Please check any output above for error details.

Hmmm how can I recreate this? The output is great and all, but I have no idea how you got here. What are the steps you took? Is this a new project? Or an older one?

I am new to Ionic react framework, I have created a new project using Ionic Start,

project Structure includes multiple files of .cmd, .ps1 format

I have tried ionic serve to an existing project but it had popped with the same error

What is the exact command you started? I just started a fresh project on my windows machine and things worked fine.

How can I recreate? What’s your environment info?

Enviroment Info

Microsoft Windows [Version 10.0.17763.379]
© 2018 Microsoft Corporation. All rights reserved.

C:\Windows\System32>node -v

C:\Windows\System32>npm -v

C:\Windows\System32>ionic -v

command i have used

ionic start --type=react

How i am running Ionic serve

created a Project using

  • npx creact-react-app <project_name>
  • cd <project_name>
  • Ionic int
  • Ionic Serve
    now project runs perfectly

project Directory looks like

after installing capacitor using (npm i capacitor)

project directory looks like this(selected file have been added to project)

I am also facing this issue, i have been trying to solve it for some days but I couldn’t, How did you solve this?