AssertionError [ERR_ASSERTION]: Task function must be specified,gulp版本不一致

报错信息:

vue项目打包报错

> gulp

assert.js:339
    throw err;
    ^

AssertionError [ERR_ASSERTION]: Task function must be specified
    at Gulp.set [as _setTask] (/home/soldier/SOLDIER/IDE_project/webStorm_project/innovate-admin-vue/node_modules/undertaker/lib/set-task.js:10:3)
    at Gulp.task (/home/soldier/SOLDIER/IDE_project/webStorm_project/innovate-admin-vue/node_modules/undertaker/lib/task.js:13:8)
    at Object.<anonymous> (/home/soldier/SOLDIER/IDE_project/webStorm_project/innovate-admin-vue/gulpfile.js:27:6)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! innovate-admin-vue@1.0.0 build: `gulp`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the innovate-admin-vue@1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2019-11-13T10_59_38_210Z-debug.log

原因:

gulp版本不一致

root@soldier-RESCUER-R720-15IKBN:/home/soldier/SOLDIER/IDE_project/webStorm_project/innovate-admin-vue# gulp -v
CLI version: 2.2.0    #全局版本
Local version: 4.0.2   #本地版本

解决办法:

让两个版本一致,gulp4.x更新变动较大,可以考虑把本地版本和全局版本都切回3.9.1版本
sudo su
  1. 卸载本地版本
npm uninstall --save-dev gulp
  1. 本地安装gulp
npm install -g gulp@3.9.1
  1. 全局安装
npm install -g gulp@3.9.1

在这里插入图片描述

你可能感兴趣的:(AssertionError [ERR_ASSERTION]: Task function must be specified,gulp版本不一致)