产卵事件错误- NodeJS
Spawn ENOENT error - NodeJS
我正在尝试使用InDesign Server使用变量通过表单传递到InDesign脚本中创建服务订单。
但是我一直得到以下错误:
/Users/rickybarnett/Desktop/curries-indesign/oos-w2p.dev/oos-curries/routes/oos.js:422
if(err) throw err;
^Error: spawn ENOENT
at errnoException (child_process.js:988:11)
at Process.ChildProcess._handle.onexit (child_process.js:779:34)
21 May 20:27:57 - [nodemon] app crashed - waiting for file changes before starting...
我已经安装了所有依赖项,并使用npm-install-missing模块进行了检查。
这个错误只发生在我的一个路由上:
// ROUTES FOR FIRST PAGE **************************************************************************************
/* GET load the first page for user editing */
router.get('/first-page', function(req, res) {
// get the pages json input list
var json = req.session.template.page_one_setup;
var form = JSON.parse(json);
TrimColours.getDropdownItems(function(results) {
res.render('oos/first-page', {trimColours: results, form: form, templateColor: req.session.templateColor});
});
});
router.post('/first-page-indesign', function(req, res){
// get the templates json input list
var json = req.session.template.page_one_setup;
var form = JSON.parse(json);
var body = req.body;
var trimColourId = body.trim_colour_id;
//perform validation
req.checkBody('name', 'Please provide a name').notEmpty();
req.checkBody('trim_colour_id', 'Please select the trim colour').notEmpty();
var errors = req.validationErrors();
if(errors) {
res.send({errors: errors});
return;
}
TrimColours.getTrimColourValueById(trimColourId, function(result) {
//store the value of trim colour in session
req.session.trimColour = result.colour_value;
req.session.templateColor = body.colorpicker;
// prepare the base arguments required by the script
var args = [
{name: 'applicationPath', value: settings.PROJECT_DIR },
{name: 'colour', value: req.session.colourValue},
{name: 'trimColour', value: result.colour_value},
{name: 'templateName', value: req.session.template_file},
{name: 'pageNumber', value: "1" },
{name: 'pageColor', value: body.colorpicker},
];
var inputs = "";
// loop over the form json string to set up the args array to be sent to the indesign script
// and to create the inputs array to be passed into the the script so the script can resolve the
// arguments and assign them to correct page items
for (var i = 0; i < form.length; i++) {
args.push({name: form[i].input_name, value: body[form[i].input_name] });
inputs += form[i].input_name + ",";
};
args.push({name: 'inputs', value: inputs.substring(0, inputs.length - 1)});
//Call the indesign server
runScript(args, body, function(result) {
req.session.userFile = result.fileName
//get unique image path returned from indesign script
var imagePath = "/oos-preview-image/" + result.image;
res.send(imagePath);
});
});
});
第442行包含在这里:"if(err) throw err;"
//function responsible for cropping an image and sending back the path
router.get('/crop-image', function(req, res) {
var url_parts = url.parse(req.url, true);
var query = url_parts.query;
var coords = query.coords.split(',');
//split the image name by "."
var croppedImageName = query.image.split('.')[0];
var extensionName = Math.round(new Date().getTime() / 1000);
//loop over the coordinates and change them into an int
for (var i = 0; i < coords.length; i++) {
coords[i] = +coords[i];
};
//create a new cropped image and pass back the name
gm(settings.PROJECT_DIR +'/public/user-images/' + query.image)
.crop(coords[0], coords[1], coords[2], coords[3])
.write(settings.PROJECT_DIR +'/public/user-images/' + croppedImageName + "_croped_" + extensionName + ".png", function(err){
if(err) throw err;
res.send(croppedImageName + "_croped_"+ extensionName +".png");
});
});
您是否在使用ImageMagick ?
-
如果是,是否安装在您的计算机上?(从这里安装:链接)
-
如果没有,你应该这样使用:
var gm = require("gm");
var im = gm.subClass({imageMagick: true});
im("path/image.png")
.crop(10,10,10,10)
.write("path/imagecropped.png", function(err){
if(err){throw err;}
});
由于某些原因,npm没有正确安装graphicsmagick,通过安装home-brew然后通过它安装graphicsmagick来修复这个问题。
相关文章:
- 与域在同一台计算机上运行的NODEJS服务器的CORS错误
- nodejs和heroku:抛出新错误(setHeader()需要“名称”和“值”');
- NodeJS错误-Can't在发送标头后设置标头
- NodeJS服务器在检索部分时返回505/404错误
- Javascript返回错误的Date值(NodeJS)
- NodeJS用Multer上传图片;错误:意外字段“”;
- 具有默认参数值的 ES6 类构造函数上的 NodeJS 错误
- 处理 nodejs 错误并提供不同自定义消息详细信息的最佳方法
- NodeJS 错误堆栈未定义
- nodejs 错误:Socket.ondata 上的解析错误
- 获取 nodejs 错误的行号
- NodeJS 错误与 connect-busboy,“类型错误:无法调用未定义的方法'on'”
- Nodejs:错误:找不到模块'html'
- NodeJS-错误:找不到指定的过程.bcrypt_lib.node
- NodeJS错误处理-使用错误代码或子类
- Nodejs错误未定义不是函数
- NodeJs错误v-host中间件
- 回调(xml-stream)中的Nodejs错误处理
- nodejs - 错误:在使用模块 gm 调整图像大小时生成 ENOENT
- Nodejs错误:协议"http:"不受支持的.预计“https:“