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.