node.js script fails - TypeError: Object 0 has no method 'on' - Mac to Arduino UNO
node.js script fails - TypeError: Object 0 has no method 'on' - Mac to Arduino UNO
当我尝试 运行 此 uvsensor.js script from this plot.ly tutorial 时遇到此错误消息。解决它的最佳方法是什么?
uv-sensor-tutorial $ node uvsensor.js
1421612122362 Device(s) /dev/cu.usbmodem1411
1421612125588 Connected /dev/cu.usbmodem1411
1421612125588 Repl Initialized
>> { streamstatus: 'All Streams Go!',
url: 'https://plot.ly/~micahstubbs/46',
message: '',
warning: '',
filename: 'uv sensing nodey arduino!',
error: '' }
/Users/m/workspace/arduino-projects/uv-sensor-tutorial/uvsensor.js:76
refLevel.on("data", function() {
^
TypeError: Object 0 has no method 'on'
at /Users/m/workspace/arduino-projects/uv-sensor-tutorial/uvsensor.js:76:14
at /Users/m/node_modules/plotly/index.js:87:17
at IncomingMessage.<anonymous> (/Users/m/node_modules/plotly/index.js:255:9)
at IncomingMessage.EventEmitter.emit (events.js:117:20)
at _stream_readable.js:920:16
at process._tickCallback (node.js:415:13)
解决它的最佳方法是找出为什么 refLevel
被分配 0
而不是您认为应该分配的对象。
当我尝试 运行 此 uvsensor.js script from this plot.ly tutorial 时遇到此错误消息。解决它的最佳方法是什么?
uv-sensor-tutorial $ node uvsensor.js
1421612122362 Device(s) /dev/cu.usbmodem1411
1421612125588 Connected /dev/cu.usbmodem1411
1421612125588 Repl Initialized
>> { streamstatus: 'All Streams Go!',
url: 'https://plot.ly/~micahstubbs/46',
message: '',
warning: '',
filename: 'uv sensing nodey arduino!',
error: '' }
/Users/m/workspace/arduino-projects/uv-sensor-tutorial/uvsensor.js:76
refLevel.on("data", function() {
^
TypeError: Object 0 has no method 'on'
at /Users/m/workspace/arduino-projects/uv-sensor-tutorial/uvsensor.js:76:14
at /Users/m/node_modules/plotly/index.js:87:17
at IncomingMessage.<anonymous> (/Users/m/node_modules/plotly/index.js:255:9)
at IncomingMessage.EventEmitter.emit (events.js:117:20)
at _stream_readable.js:920:16
at process._tickCallback (node.js:415:13)
解决它的最佳方法是找出为什么 refLevel
被分配 0
而不是您认为应该分配的对象。