2011-12-12 3 views
2

을 실행할 때 :Node.js를 오류 : ENOSYS 산란 나는 유닉스에서 Node.js를 실행하려고하고,이 오류 dooing지고있어 명령 줄 명령

var exec = require('child_process').exec; 

var commandLine = "/var/util/generate 300 300 > /tmp/barcode.png"; 
var childProcess; 

http.createServer(function (req, res) { 

var request = url.parse(req.url, true); 
var action = request.pathname; 

if (action == '/barcode.png') { 

    console.log('executes commandLine'); 

    // executes 'commandLine' 
    childProcess = exec(commandLine, 
     function (error, stdout, stderr) { 
      sys.print('stdout: ' + stdout); 
      sys.print('stderr: ' + stderr); 
      var img = fs.readFileSync('/tmp/barcode.png'); 
      res.writeHead(200, { 
       'Content-Type' : 'image/png' 
      }); 
      res.end(img, 'binary'); 
      if (error !== null) { 
       console.log('exec error: ' + error); 
      } 
     }); 
} else { 
    res.writeHead(200, { 
     'Content-Type' : 'text/plain' 
    }); 
    res.end('QR Generate service reply: Please provide correct request parameter \n'); 
    }  
}).listen(8888); 

을 console.log는 ("QR 서비스를 실행 생성을 at http://localhost:8888 ");

그러나 내가 갖는 :

Error: ENOSYS spawn 
    at errnoException (child_process.js:476:11) 
    at ChildProcess.spawn (child_process.js:443:11) 
    at child_process.js:341:9 
    at Object.execFile (child_process.js:250:15) 
    at child_process.js:217:18 
    at Server.<anonymous> (/base/usr/node/service.js:139:18) 
    at Server.emit (events.js:70:17) 
    at HTTPParser.onIncoming (http.js:1479:12) 
    at HTTPParser.onHeadersComplete (http.js:102:31) 
    at Socket.ondata (http.js:1375:22) 

을이 간부 칠 때는 (

은 어떤 문제가 노드의

버전 0.6.4

+0

'/ var/util/generate 300 300> /tmp/barcode.png '명령 줄에 성공적으로 있습니까? – alessioalex

+0

예, 작동합니다./tmp에 올바른 파일을 만듭니다. –

답변

0

가에 대한 해결책이 없습니다입니까? 내 문제는 서비스 기간에 산란을 지원하지 않는 플랫폼에서 실행 되었음