最近由于升级了node,回过头来项目的gulp用不了了…原来是gulp3.x不支持 node10.x。行,重新安装全局gulp
#删除原来的
npm rm -g gulp#全局安装新的
npm install -g gulp-cli
然后准备更新项目上依赖的gulp,但是突然想到gulp4 对 gulp3 有些语法是不支持的,比如:
# gulp3写法
gulp.task('default', ['sass', 'imagemin']);#gulp4写法
// If your tasks are dependent then change above to series as follows
gulp.task('default', gulp.series('sass', 'imagemin'));// OR ELSE, if the tasks are independent then it can be run in parallel as follows
gulp.task('default', gulp.parallel('sass', 'imagemin'));
等等等等…
想到还要去修改之前写的那些gulpfile 头皮发麻,所以决定不升级项目的gulp依赖,找个能兼容的插件支持一下就行,
npm i natives
大家可以去看看相关信息:
1、UPGRADING YOUR GULP FOR RUNNING WITH NODE 10
2、github 相关issues