Error: Cannot read property 'replace' of null

I am getting this error whenever I add android platform in my project.

ionic platform add android

Your system information:

Cordova CLI: 6.5.0 
Ionic CLI Version: 2.1.13
Ionic App Lib Version: 2.1.7
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Linux 2.6
Node Version: v4.2.1
Xcode version: Not installed


Update your ionic CLI, cordova and Node version.