跳到主要内容
CNode

求助,NODE sudo gm 异常。。。。

社区
Jjimiechan发布于 13 年前
042240

为什么加了sudo运行就会异常。。。求助各位大虾,谢谢!!

异常情况 [root@AY120813024712cf42614 test]# sudo node test_cp07.js

stderr: execvp(): No such file or directory

events.js:72 throw er; // Unhandled 'error' event ^ Error: spawn ENOENT

at errnoException (child_process.js:975:11)

at Process.ChildProcess._handle.onexit (child_process.js:766:34)

//正常情况,也生成图片缩略图 [root@AY120813024712cf42614 test]# node test_cp07.js

child process exited with code 0

test_cp07.js源码

var spawn = require('child_process').spawn,

ls = spawn('gm', ["convert" ,"-quality","50" ,"../183-1.jpg","-scale" ,"117x100" ,"-crop", "100x100+0+0" ,"+profile", ""*"" ,"123455555.jpg"]);

ls.stdout.on('data', function (data) { console.log('stdout: ' + data); });

ls.stderr.on('data', function (data) { console.log('stderr: ' + data); });

ls.on('close', function (code) { console.log('child process exited with code ' + code); });

操作系统版本 CentOS release 5.7 (Final)64位

node版本为0.10.5

gm版本

GraphicsMagick 1.3.18 2013-03-10 Q16 http://www.GraphicsMagick.org/ Copyright (C) 2002-2013 GraphicsMagick Group. Additional copyrights and licenses apply to this software. See http://www.GraphicsMagick.org/www/Copyright.html for details.

Feature Support: Thread Safe yes Large Files (> 32 bit) yes Large Memory (> 32 bit) yes BZIP yes DPS no FlashPix no FreeType yes Ghostscript (Library) no JBIG no JPEG-2000 no JPEG yes Little CMS no Loadable Modules no OpenMP yes (200505) PNG yes TIFF yes TRIO no UMEM no WMF no X11 no XML no ZLIB yes

Host type: x86_64-unknown-linux-gnu

Configured using the command: ./configure '--prefix=/opt/tools/graphicsmagick' '--enable-shared' '--enable-static' '--with-quantum-depth=16' '--with-ttf' '--with-jpeg' '--with-jp2' '--with-png' '--with-zlib'

Final Build Parameters: CC = gcc -std=gnu99 CFLAGS = -fopenmp -g -O2 -Wall -pthread CPPFLAGS = -I/usr/include/freetype2 CXX = g++ CXXFLAGS = -pthread LDFLAGS = -L/usr/lib LIBS = -ltiff -lfreetype -ljpeg -lpng12 -lbz2 -lz -lm -lgomp -lpthread

查看回复

回复 (0)

暂无回复,成为第一个参与讨论的人。

参与回复

登录后即可参与回复。登录