我试图运行这个关于环回的CoffeeShop示例:
http://loopback.io/doc/en/lb2/Create-AngularJS-client.html
在与AngularJS集成时出现错误似乎没问题
使用以下命令时:
lb-ng server/server.js client/js/services/lb-services.js
我得到了错误堆栈:
Loading LoopBack app "/home/dqlgnoleht/Working/Projects/loopback-getting-started/server/server.js"
/home/dqlgnoleht/Working/Projects/loopback-getting-started/node_modules/async/dist/async.js:1340
return fn.apply(null, args.concat(callArgs));
^
TypeError: Cannot read property 'apply' of undefined
at /home/dqlgnoleht/Working/Projects/loopback-getting-started/node_modules/async/dist/async.js:1340:22
at apply (/home/dqlgnoleht/Working/Projects/loopback-getting-started/node_modules/async/dist/async.js:40:29)
at /home/dqlgnoleht/Working/Projects/loopback-getting-started/node_modules/async/dist/async.js:76:16
at /home/dqlgnoleht/Working/Projects/loopback-getting-started/node_modules/async/dist/async.js:3828:13
at replenish (/home/dqlgnoleht/Working/Projects/loopback-getting-started/node_modules/async/dist/async.js:1018:21)
at /home/dqlgnoleht/Working/Projects/loopback-getting-started/node_modules/async/dist/async.js:1022:13
at eachOfLimit (/home/dqlgnoleht/Working/Projects/loopback-getting-started/node_modules/async/dist/async.js:1049:26)
at /home/dqlgnoleht/Working/Projects/loopback-getting-started/node_modules/async/dist/async.js:1054:20
at eachOf (/home/dqlgnoleht/Working/Projects/loopback-getting-started/node_modules/async/dist/async.js:1127:9)
at _parallel (/home/dqlgnoleht/Working/Projects/loopback-getting-started/node_modules/async/dist/async.js:3827:9)
如何正确运行?或者我只是错过了一些配置。请帮忙!
非常感谢您的任何帮助!
答案 0 :(得分:1)
您应该返回一个返回异步函数的函数。它可能是这样的:
<强>模型/ candidate.js 强>
module.exports = function (Candidate) {
Candidate.getRawCV = getRawCV(Candidate);
function getRawCV (Candidate) {
return async function (next) {
...async code...
}
}
}