NodeJS:错误:产生EINVAL

时间:2012-08-15 08:59:35

标签: node.js

ENV:

[root@etone46 backups]# uname -a
Linux etone46 2.6.18-53.el5xen #1 SMP Wed Oct 10 16:48:44 EDT 2007 x86_64 x86_64 x86_64 GNU/Linux
[root@etone46 backups]# node -v
v0.8.6

代码是来自节点doc的复制。

var util  = require('util'),
    spawn = require('child_process').spawn,
        ls    = spawn('ls', ['-lh', '/usr']);

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

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

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

收到错误:

  

[root @etone46 backups] #node 1.js

child_process.js:790
    throw errnoException(errno, 'spawn');
          ^
Error: spawn EINVAL
    at errnoException (child_process.js:838:11)
    at ChildProcess.spawn (child_process.js:790:11)
    at exports.spawn (child_process.js:614:9)
    at Object.<anonymous> (/opt/backups/1.js:3:14)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.runMain (module.js:492:10)
    at process.startup.processNextTick.process._tickCallback (node.js:244:9)

0 个答案:

没有答案