Async-kit和async.series不是一个函数

时间:2016-11-07 15:05:37

标签: node.js

我正在尝试使用async-kit来解决一些异步问题。 我的简化代码是:

var async = require('asynckit');

async.series([
  function( callback ) {
    console.log("print 1");
  },
  function(callback){
    console.log("print 2"}
])
.exec(function(error, result) {
    console.log("1 and 2 printed");
});

但应用程序返回:async.series不是函数 为什么呢?

1 个答案:

答案 0 :(得分:0)

asynckit似乎没有public long AvailableFreeSpace() { long longAvailableFreeSpace = 0; try{ DriveInfo[] arrayOfDrives = DriveInfo.GetDrives(); foreach (var d in arrayOfDrives) { Console.WriteLine("Drive {0}", d.Name); Console.WriteLine(" Drive type: {0}", d.DriveType); if (d.IsReady == true && d.Name == "/data") { Console.WriteLine("Volume label: {0}", d.VolumeLabel); Console.WriteLine("File system: {0}", d.DriveFormat); Console.WriteLine("AvailableFreeSpace for current user:{0, 15} bytes",d.AvailableFreeSpace); Console.WriteLine("TotalFreeSpace {0, 15} bytes",d.TotalFreeSpace); Console.WriteLine("Total size of drive: {0, 15} bytes \n",d.TotalSize); } longAvailableFreeSpaceInMB = d.TotalFreeSpace; } } catch(Exception ex){ ServiceLocator.GetInsightsProvider()?.LogError(ex); } return longAvailableFreeSpace; } 方法。您要么找series 要么 您已将async.serial模块与async模块混淆,后者具有asynckit功能。