简体   繁体   English

运行dyson模拟服务器(使用express.js)的异常“ TypeError:对象原型只能是对象或为空”

[英]Exception 'TypeError: Object prototype may only be an Object or null' running dyson mock server (using express.js)

Running the webpro/dyson-demo (node.js) as a mock server and attempted to return a canned data, for example: 将webpro / dyson-demo(node.js)作为模拟服务器运行,并尝试返回罐装数据,例如:

module.exports = {
  path: '/query?',
  collection: false,
  template: function(params, query, body, cookies, headers) {
        return cannedJsonFromFile;
    },

}; };

But received the error message (dyson uses Express.js): 但是收到了错误消息(戴森使用Express.js):

"Potentially unhandled rejection [1] TypeError: Object prototype may only be an Object or null: ..." (bottom of stack): at c:\\dev\\projects\\noms\\navmps.services.demo\\dyson-mock-oob-server\\dyson-demo\\node_modules\\dyson\\lib\\response.js:82:53 “可能未处理的拒绝[1] TypeError:对象原型只能是对象或null:...”(堆栈底部):位于c:\\ dev \\ projects \\ noms \\ navmps.services.demo \\ dyson-mock-oob -server \\戴森-演示\\ node_modules \\戴森\\ lib中\\ response.js:82:53

The canned data was loaded as a JSON string '{...}' and needed to be converted to a an object using JSON.parse: 罐装数据已作为JSON字符串“ {...}”加载,需要使用JSON.parse转换为对象:

module.exports = {
  path: '/query?',
  collection: false,
  template: function(params, query, body, cookies, headers) {
        return JSON.parse(cannedJsonFromFile);
    },

}; };

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 未捕获的TypeError:Symfony 2中的ExtJS对象原型只能是Object或为null - Uncaught TypeError: Object prototype may only be an Object or null with ExtJS in Symfony 2 TypeError: Object prototype may only be an Object or null: undefined - TypeError: Object prototype may only be an Object or null: undefined 未捕获的类型错误:Object 原型可能只是 Object 或 null:未定义 - Uncaught TypeError: Object prototype may only be an Object or null: undefined 未捕获的TypeError:对象原型可能只是一个Object,或者在ember.js上为null - Uncaught TypeError: Object prototype may only be an Object or null on ember.js Node.JS对象原型可能只是一个Object,或者使用Redis为null - Node.JS object prototype may only be an Object or null with Redis Extjs Sencha编译的应用程序引发Uncaught TypeError:对象原型只能是Object或null - Extjs sencha compiled app throws Uncaught TypeError: Object prototype may only be an Object or null 未捕获的TypeError:对象原型可能只是一个Object,或者在ember-1.0.0-pre.2上为null - Uncaught TypeError: Object prototype may only be an Object or null on ember-1.0.0-pre.2 带Typescript抛出TypeError的React Relay(react-relay):对象原型只能是一个Object或为null:未定义 - React Relay (react-relay) with Typescript throwing TypeError: Object prototype may only be an Object or null: undefined TypeScript错误对象原型只能是一个对象或null:未定义 - TypeScript Error Object prototype may only be an Object or null: undefined 使用jade模板在Express.js中使用公开的对象作为值或帮助程序? - Using an exposed object as value or helper in Express.js with jade templating?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM