Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/templates/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 未定义nodejs异步myMethod_Node.js_Node Async - Fatal编程技术网

Node.js 未定义nodejs异步myMethod

Node.js 未定义nodejs异步myMethod,node.js,node-async,Node.js,Node Async,从async中调用自己的模块方法时,我遇到以下错误 ReferenceError: RetriveLongitude is not defined at D:\Userfiles\oozen\Workspace\sas_1.0_server\sas_1.0\backgroundProcesses\searchTravelSolutions\PositionReferences.js:234:5 at D:\Userfiles\oozen\Workspace\sas_1.0_ser

从async中调用自己的模块方法时,我遇到以下错误

ReferenceError: RetriveLongitude is not defined
    at D:\Userfiles\oozen\Workspace\sas_1.0_server\sas_1.0\backgroundProcesses\searchTravelSolutions\PositionReferences.js:234:5
    at D:\Userfiles\oozen\Workspace\sas_1.0_server\sas_1.0\node_modules\async\lib\async.js:570:21
    at D:\Userfiles\oozen\Workspace\sas_1.0_server\sas_1.0\node_modules\async\lib\async.js:249:17
    at D:\Userfiles\oozen\Workspace\sas_1.0_server\sas_1.0\node_modules\async\lib\async.js:125:13
    at Array.forEach (native)
位置参考
模块如下所示:

var RetrieveCoordinates = function(tw, callback){

  async.parallel([function(callback) {
    RetrieveLatitude(tw, callback);
  }, function(callback) {
    RetriveLongitude(tw, callback);
  }
  ], function(err, coordinates) {
    if (err) {
      console.log('err occuured in Lattitude / Longitude retrieval : ' + err);
      return callback(err);
    }

    callback(null, coordinates);
  });

}

function RetrieveLatitude(tw, callback) {

  var latitude = JsonInfo.getLatitude(tw);
  // check if the user has already specified a place (e.g. Eiffel tower) in tw
  if (latitude != undefined) {
    return callback(null, latitude);
  }
  // get latitude of the airport from the DB
  db.collection('city').find({
    "information.airports.code": place
  }).toArray(function(err, position) {
    if (err) return callback(err);
    latitude = position['information']['city_coordinates']['latitude'];
    console.log("[PositionReferences-RetrieveLatitude] found" + Lat);
    return callback(null, latitude);    
  });
}
function RetrieveLongitude(tw, callback) {
  var longitude = JsonInfo.getLongitude(tw);
  // check if the user has already specified a place (e.g. Eiffel tower) in tw
  if (longitude != undefined) {
  return callback(null, longitude); }
  db.collection('city').find({
    "information.airports.code": place
  }).toArray(function(err, position) {
    if (err) return callback(err);
    city = postion['name'];
    longitude = position['information']['city_coordinates']['longitude'];
    console.log("[PositionReferences-RetrieveLatitude] found" + longitude);
    return callback(nulll, longitude);
  });
}
//module.exports.RetrieveLatitude = RetrieveLatitude;
//module.exports.RetrieveLongitude = RetrieveLongitude;
module.exports.RetrieveCoordinates = RetrieveCoordinates;
除了声明:
module.exports.RetrieveLatitude

我还尝试设置
var=this
并对其调用Lat/Long方法


为什么这些都不起作用?

您正在调用的是
RetrieveLongitude
,而不是
RetrieveLongitude

该错误与node-async…等无关。这只是一个打字错误。。