gulp-px2rem-plugin报错Cannot read property ‘forEach‘ of null
程序员文章站
2022-03-04 11:03:50
...
今天使用gulp-less+gulp-px2rem-plugin报了错,经测试后发现, 原因是我其中一个less文件编译的css为空(全是less函数也为空),使得gulp-px2rem-plugin报错(write callback called multiple times或者Cannot read property ‘forEach’ of null)
解决办法:
在gulp-px2rem-plugin源码index.js文件中26行加入空判断:array_style &&
array_style && array_style.forEach(function(value){
// ... 其他代码
}
或者在有可能编译为空的less文件中加一点内容
// 随便加上,无意义,且不影响
*{}
推荐阅读
-
Vue报错:Uncaught TypeError: Cannot assign to read only property’exports‘ of object
-
npm ERR! Cannot read property 'path' of null
-
js报错 Cannot read property 'getAttribute' of null
-
webpack报错Cannot read property 'presetToOptions' of undefined
-
JavaScript Uncaught TypeError: Cannot read property 'value' of null
-
Vue报错:Uncaught TypeError: Cannot assign to read only property’exports‘ of object’#
-
el-tooltip组件中content使用Vue-i18n报错TypeError: Cannot read property ‘$t‘ of null
-
Extjs4 tabPanel关闭后打开 cannot read property addcls of null
-
Vue报错:Uncaught TypeError: Cannot assign to read only property’exports‘ of object
-
Vue引入echarts报错Error in mounted hook: “TypeError: Cannot read property ‘getAttribute‘ of null“