Caught exception: TypeError: Cannot call method 'insert' of undefined

mac 10.9.1, pomelo 0.8.9

使用 pomelo.app.get('dbclient').insert(sql, args, function(err, res) {...});

出现 Caught exception: TypeError: Cannot call method 'insert' of undefined

可以确定的是,在前面的代码中已经使用过该方法

如果换成 

var dbclient = pomelo.app.get('dbclient');

dbclient.insert(sql, args, function(err,res) {...}); 

就能通过

后来发现,是在函数前面多了一个空格

空格characterDao.createCharacter = function() {...}

将空格去掉,就正常了

原因,待查。。。

后来发现有几个地方应该打“;”的,写的是“,”

将他们修改为“;”后,再把上面函数前加上空格,好像又能正常运行

无法直视。。。。

原文地址:https://www.cnblogs.com/shadow21/p/3645665.html