|
阅读:11606回复:0
gulp-autoprefixer 报错bug : TypeError: this is not a typed array
使用gulp-autoprefixer 自动给css文件添加前缀,代码如下:
const autoprefixer = require("gulp-autoprefixer"); gulp.task("prefixCss",function(){ "use strict"; return gulp.src("./src/public/css/style1.css") .pipe(autoprefixer({ //需要兼容的浏览器 browsers: ['last 20 versions',"ie 7"] })) .pipe(gulp.dest("./dist/public/css")) }); 在执行时,却报错,提示:TypeError: this is not a typed array , 如下图: 图片:prefix_error.png
检查错误,发现错误提示在包文件中,怀疑包有问题。然后,重新下载,下载时发现了问题所在: 图片:nodeversion.png
原来是版本问题,gulp-autoprefixer 插件要求node版本大于4.5 , 而我的版本却是4.4.7 . 于是,将nodejs 的版本提升(直接安装高版本)。安装高版本后,运行一切正常。问题解决 |
|
|
