在我的 angularjs 应用程序中,我使用 esprima.js 验证和 gulp。现在,esprima 给我这两个 js 的错误。
internal/streams/legacy.js:59
throw er; // Unhandled stream error in pipe.
^
错误:第 38843 行:意外的标识符
这是第一块
var filteredCampaignItems = campaignItems.filter((thing, index, self) => index === self.findIndex((t) => (
t.expectedAdvertisementDisplayCount === thing.expectedAdvertisementDisplayCount && t.smartId === thing.smartId
))
)
第二个是求和的过滤器
app.filter('sumProduct', function() {
return function (input) {
var i = input instanceof Array ? input.length : 0;
var a = arguments.length;
if (i === 0)
return i;
var total = 0;
for(var x of input){
var duration = parseFloat(x.meta_duration);
if(isNaN(duration)){
throw 'filter sumProduct can count only numeric values';
}
total += duration;
}
return total;
}
});
Esprima 版本是"version": "4.0.0"
,我发现我需要获取版本的instanbul 依赖"istanbul": "^1.0.0-alpha.2"
,我手动更改为版本1.0.0-alpha.2
并调用npm i esprima
。我这样做,但同样的错误被抛出。
有人知道如何解决这个问题吗?