I was having the same problem. Using the versions MatheusEli suggested solved it.
If this isn’t working for you, try to do
cordova plugin ls & make sure it shows the correct oneSignal plugin version. Mine wasn’t, so i had to remove the old version then install the new one.