When I typed gulp test
, I get this error: require('connect').json() is undefined.
. What should I do?
The detail error message as following:
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)
I dunno how that solve the problem ... Actually you are trying to use JSON() in connect module... Error shows json itself undefined and you are invoking using function ()... ?
I fixed that problem by:
npm install karma karma-jasmine karma-phantomjs-launcher --save-dev