Cant update capacitor core

I want to use the android emulator so I tried to add android to my ionic react project.

I used the command
“npx cap add android”
It said i had to install android first so i did
“npm install capacitor/android”
it gave an error wich i guessed was that i had an old capacitor core version so i did
“ionic capacitor update”

This didnt work. Error log in screenshot

Does anyone know what the problem is?