当我输入gulp test
时,我收到此错误:require('connect').json() is undefined.
。我该怎么办?
详细错误消息如下:
tianjiedeMacBook-Pro:meiyanapp tianjie$ gulp test
/Users/tianjie/meiyanruhua/meiyanapp/node_modules/karma/lib/middleware/runner.js:11
var json = require('connect').json();
^ TypeError: undefined is not a function
at Object.<anonymous> (/Users/tianjie/meiyanruhua/meiyanapp/node_modules/karma/lib/middleware/runner.js:11:31)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/Users/tianjie/meiyanruhua/meiyanapp/node_modules/karma/lib/web-server.js:7:24)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
答案 0 :(得分:2)
我通过以下方式解决了这个问题:
npm install karma karma-jasmine karma-phantomjs-launcher --save-dev
答案 1 :(得分:0)
我不知道如何解决这个问题......其实你是在尝试在连接模块中使用JSON()...错误显示json本身未定义并且你正在使用function()调用...?