我通过浏览互联网上的示例来吸收nodejs。 我遇到了一个代码,我没有得到任何输出。
var file=' H:/node/t/5848069af6b4292040b6e737 ';
const execFile = require('child_process').execFile;
var args = ['-format']
args.push('"%m %z %w %h %b %x %y %f"')
args.push(file)
child = execFile('identify', args, function(err, stdout, stderr) {
var info = {};
console.log(err);
console.log(stderr);
if (stdout) {
console.log('hurrrrayyyyyyyy stdout'+stdout);
} else {
console.log('no stdout');
}
});
我收到错误
{ Error: spawn identify ENOENT
at exports._errnoException (util.js:1026:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
at onErrorNT (internal/child_process.js:359:16)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)
at Module.runMain (module.js:606:11)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:509:3
code: 'ENOENT',
errno: 'ENOENT',
syscall: 'spawn identify',
path: 'identify',
spawnargs:
[ '-format',
'"%m %z %w %h %b %x %y %f"',
' H:/node/t/5848069af6b4292040b6e737 ' ],
cmd: 'identify -format "%m %z %w %h %b %x %y %f" H:/node/t/5848069af6b4292040b6e737 ' }
但是当我运行cmd时:-identify -format"%m%z%w%h%b%x%y%f" H:/ node / t / 5848069af6b4292040b6e737它的工作正常。请帮助我