32

When a try to run

ionic run android --device

I'm getting an error of module:

Error: Cannot find module 'android-versions'

Versions:

java -version 
  java version "1.8.0_144"
Android studio Version 2.3.3
ionic -v
2.2.1
cordova -v
6.5.0
sebaferreras
  • 44,206
  • 11
  • 116
  • 134
ehh
  • 1,659
  • 2
  • 13
  • 11

3 Answers3

112

I found the problem and expect help somebody. I just run

npm install android-versions --save

in the project folder and worked.

ehh
  • 1,659
  • 2
  • 13
  • 11
16

Not sure if this will help some other Ionic developers, but I was getting the same Error: Cannot find module 'android-versions' and I fixed it by removing and adding the Android platform again:

ionic cordova platform remove android --save

And then

ionic cordova platform add android --save
sebaferreras
  • 44,206
  • 11
  • 116
  • 134
4

If anyone is having this issue while using yarn and even after adding android-versions... it seems that there are differences in yarn/npm files which break...

I ended up removing my node_modules folder, then installing it with npm instead of yarn. It worked!

Hugo H
  • 6,029
  • 5
  • 37
  • 57