Closed highmind closed 7 years ago
@highmind 已收到,正在查看
@highmind 出现此问题是因为 mockjs 本身的问题,在其源代码中有以下说明:
dataImage: function(size, text) {
var canvas
if (typeof document !== 'undefined') {
canvas = document.createElement('canvas')
} else {
/*
https://github.com/Automattic/node-canvas
npm install canvas --save
安装问题:
* http://stackoverflow.com/questions/22953206/gulp-issues-with-cario-install-command-not-found-when-trying-to-installing-canva
* https://github.com/Automattic/node-canvas/issues/415
* https://github.com/Automattic/node-canvas/wiki/_pages
PS:node-canvas 的安装过程实在是太繁琐了,所以不放入 package.json 的 dependencies。
*/
var Canvas = module.require('canvas')
canvas = new Canvas()
}
你可以根据给出的地址尝试安装 canvas包,我自己尝试过,并没有成功。如果你尝试成功,可以在此写下解决办法,谢谢
{ "array|1-10": [ 1, 2, 3 ], "boolean": true, "null": null, "number": 123, "object": { "a": "b", "c": "d", "e": "f" }, "url": "@image", "string": "Hello World" }
url为@image 可以,换为 @dataImage则 接口提示
Internal Server Error module.require is not a function