What should I do for this error: require('connect').json() is undefined
What should I do for this error: require('connect').json() is undefined
当我键入 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)
我通过以下方式解决了这个问题:
npm install karma karma-jasmine karma-phantomjs-launcher --save-dev
我不知道那是如何解决问题的...实际上您正在尝试在连接模块中使用 JSON()...错误显示 json 本身未定义并且您正在使用函数调用 ( )...?
当我键入 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)
我通过以下方式解决了这个问题:
npm install karma karma-jasmine karma-phantomjs-launcher --save-dev
我不知道那是如何解决问题的...实际上您正在尝试在连接模块中使用 JSON()...错误显示 json 本身未定义并且您正在使用函数调用 ( )...?