diff --git a/bin/templates/cordova/Api.js b/bin/templates/cordova/Api.js index 74549fe6..b7411dcc 100644 --- a/bin/templates/cordova/Api.js +++ b/bin/templates/cordova/Api.js @@ -354,13 +354,24 @@ Api.prototype.run = function(runOptions) { */ Api.prototype.clean = function(cleanOptions) { var self = this; + try { return require('./lib/check_reqs').run() - .then(function () { - return require('./lib/build').runClean.call(self, cleanOptions); - }) - .then(function () { - return require('./lib/prepare').clean.call(self, cleanOptions); - }); + .then(function () { + return require('./lib/build').runClean.call(self, cleanOptions); + }) + .then(function () { + return require('./lib/prepare').clean.call(self, cleanOptions); + }); + } + catch (err) { + return require('../../lib/check_reqs').run() + .then(function () { + return require('./lib/build').runClean.call(self, cleanOptions); + }) + .then(function () { + return require('./lib/prepare').clean.call(self, cleanOptions); + }); + } }; /**