Unable to resolve "ionic cordova run android" errors

Hi,

I am using ionic CLI version 4.1.2 while i am trying to run my ionic v1 project and it’s been three days that I’ve struggling to run my project as there are huge no. of changes that have occurred since v1. Finally after resolving most of the issues, i’m find it hard to resolve issues related to gulp which says -

[12:55:39] Cannot load gulp: TypeError: gulp.hasTask is not a function
[12:55:39] Cannot load gulp: TypeError: gulp.hasTask is not a function
[12:55:39] Cannot run sass task: missing in gulpfile.js
[12:55:39] Cannot load gulp: TypeError: gulp.hasTask is not a function

Although i followed the disscussion 49085 but it is of no help as “ionic setup sass” doesn’t work anymore and also reverting gulp package to v3.9 is not compatible with other packages.

Below are all the errors that are generated after running the command -

C:\Users\umaka\Desktop\LocalCircles Mobile\mobile-app>ionic cordova build android

ionic-v1 build
[13:13:23] Cannot load gulp: TypeError: gulp.hasTask is not a function
[13:13:23] Cannot load gulp: TypeError: gulp.hasTask is not a function
[13:13:23] Cannot run sass task: missing in gulpfile.js
[13:13:23] Cannot load gulp: TypeError: gulp.hasTask is not a function
cordova build android
Error: Cannot find module ‘internal/util/types’
at Function.Module._resolveFilename (module.js:548:15)
at Function.Module._load (module.js:475:25)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at evalmachine.:31:26
at Object. (C:\Users\umaka\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\tar\node_modules\fstream\node_modules\graceful-fs\fs.js:11:8)
at Module._compile (module.js:653:30)
at Object.Module._extensions…js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
[ERROR] An error occurred while running subprocess cordova.

    cordova build android exited with exit code 1.

    Re-running this command with the --verbose flag may provide more information.

And this is my gulpfile.js -
var gulp = require(‘gulp’);
var gutil = require(‘gulp-util’);
var bower = require(‘bower’);
var concat = require(‘gulp-concat’);
var sass = require(‘gulp-sass’);
var minifyCss = require(‘gulp-minify-css’);
var rename = require(‘gulp-rename’);
var sh = require(‘shelljs’);

var paths = {
sass: [‘./scss/**/*.scss’]
};

gulp.task(‘sass’, gulp.series(function(done) {
gulp.src(‘./scss/ionic.app.scss’)
.pipe(sass())
.on(‘error’, sass.logError)
.pipe(gulp.dest(‘./www/css/’))
.pipe(minifyCss({
keepSpecialComments: 0
}))
.pipe(rename({ extname: ‘.min.css’ }))
.pipe(gulp.dest(‘./www/css/’))
.on(‘end’, done);
}));

gulp.task(‘default’, gulp.parallel(‘sass’));

gulp.task(‘watch’, gulp.parallel(function() {
gulp.watch(paths.sass, gulp.series(‘sass’));
}));

gulp.task(‘git-check’, gulp.series(function(done) {
if (!sh.which(‘git’)) {
console.log(
’ ’ + gutil.colors.red(‘Git is not installed.’),
‘\n Git, the version control system, is required to download Ionic.’,
‘\n Download git here:’, gutil.colors.cyan(‘Git - Downloads’) + ‘.’,
‘\n Once git is installed, run '’ + gutil.colors.cyan(‘gulp install’) + ‘' again.’
);
process.exit(1);
}
done();
}));

gulp.task(‘install’, gulp.series(‘git-check’, function() {
return bower.commands.install()
.on(‘log’, function(data) {
gutil.log(‘bower’, gutil.colors.cyan(data.id), data.message);
});
}));

Please help.

What is your ionic info output?

Below is the info, it shows error with bower.json although i have already installed bower -

[ERROR] Error with .\bower.json file: Error: ENOENT: no such file or directory, open
‘C:\Users\umaka\Desktop\LocalCircles Mobile\mobile-app\bower.json’
√ Gathering environment info - done!

Ionic:

ionic (Ionic CLI) : 4.1.2
Ionic Framework : unknown
@ionic/v1-toolkit : 1.0.8

Cordova:

cordova (Cordova CLI) : 3.5.0-0.2.7
Cordova Platforms : not available
Cordova Plugins : no whitelisted plugins (18 plugins total)

System:

NodeJS : v8.12.0 (C:\Program Files\nodejs\node.exe)
npm : 6.4.1
OS : Windows 10

running npm ls bower shows, bower is installed -

npm ls bower
lc@1.1.1 C:\Users\umaka\Desktop\LocalCircles Mobile\mobile-app
`-- bower@1.8.4

So this file exists but the output tells otherwise?

That is not good. Do you kknow what version your app is using?

That is also suuuuuuper old.
You can read about how to figure out the current Cordova versions and how to update CLI, platforms and plugins here: How to update Cordova CLI, Platforms and Plugins · ionic.zone

Also: Please edit your post, it is not very readable at the moment.
Use the </> button above the input field to format your code, command line output or error message (select the text first, then click the button or wrap it in ``` manually). Check the preview if it looks better. This will make sure your text is readable and if it recognizes the programming language it also automatically adds code syntax highlighting. Thanks.

Did you end up finding a fix for this?