现在我使用了这段代码:
<code>process = require('child_process');
var ls = process.spawnSync('node','lookUp.js ' + serialNumber);
ls.stdout.on('data', function(data) {
console.log('stdout: ' + data);
}); </code>
收到了这个错误:
<code>
child_process.js:1254
for (i = 0; i < options.stdio.length; i++) {
^
TypeError: Cannot read property 'length' of undefined
at Object.spawnSync (child_process.js:1254:32)
at /home/eweba1-pc-22/htdocs/geoAdmin/myAdminTester/zohocrm-myadmin-module-to-get-devices/service2.js:252:22
at Object.whilst (/home/eweba1-pc-22/htdocs/geoAdmin/myAdminTester/zohocrm-myadmin-module-to-get-devices/node_modules/async/dist/async.js:4578:9)
at Request._callback (/home/eweba1-pc-22/htdocs/geoAdmin/myAdminTester/zohocrm-myadmin-module-to-get-devices/service2.js:211:10)
at Request.self.callback (/home/eweba1-pc-22/htdocs/geoAdmin/myAdminTester/zohocrm-myadmin-module-to-get-devices/node_modules/request/request.js:200:22)
at Request.EventEmitter.emit (events.js:110:17)
at Request.<anonymous> (/home/eweba1-pc-22/htdocs/geoAdmin/myAdminTester/zohocrm-myadmin-module-to-get-devices/node_modules/request/request.js:1067:10)
at Request.EventEmitter.emit (events.js:129:20)
at IncomingMessage.<anonymous> (/home/eweba1-pc-22/htdocs/geoAdmin/myAdminTester/zohocrm-myadmin-module-to-get-devices/node_modules/request/request.js:988:12)
at IncomingMessage.EventEmitter.emit (events.js:129:20)
</code>