I’m trying to follow the few instructions here: https://www.npmjs.com/package/@ionic/react
So i first used create-react-app
, then installed @ionic/latest @ionic/core
and @ionic/react
Then executed ionic init (custom)
ionic capacitor add android
ionic capacitor copy
ionic capacitor run
but at this point my vojage stopeed
> $ ionic capacitor run
? What platform would you like to run? android
[ERROR] Cannot perform build.
Since you're using the custom project type, you must provide the ionic:build npm script so the Ionic CLI can
build your project.
I don’t find how to add this build command…
I added this to package.jsonn
scritps
"ionic:build": "react-scripts build"
Running again ionic capacitor run android
i got warning about need of router module
.\node_modules\@ionic\react\dist\components\navigation\IonTabBar.js
Cannot find module: 'react-router'. Make sure this package is installed.
You can install this package by running: yarn add react-router.
So I executed
npm add react-router --save
And re-runn ionic capacitor run android
It did a LOT of things, and also opened automatically Android Studio (I was using Vs Code on Windows 10) when the build phase began.It also downloaded a LOT of packages related to Android from official Google repository.
I at last, faced with this error
Cannot load module file ‘C:/Progetti/ionic/ionic-react/android/android.iml’:
File C:\Progetti\ionic\ionic-react\android\android.iml does not exist
Would you like to remove module ‘android’ from the project?
Any Idea of what was the attended procedure ?