Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/arduino/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 找不到模块';强尼五号;?_Node.js_Arduino_Raspberry Pi_Arduino Uno_Johnny Five - Fatal编程技术网

Node.js 找不到模块';强尼五号;?

Node.js 找不到模块';强尼五号;?,node.js,arduino,raspberry-pi,arduino-uno,johnny-five,Node.js,Arduino,Raspberry Pi,Arduino Uno,Johnny Five,我对这一点相当陌生,如果答案显而易见,我很抱歉。我正在尝试编程一个Arduino Uno板,使其通过node.js和Raspberry Pi 3b+上的johnny five(使用rpi作为桌面)连接到的试验板上的LED亮起。我安装了node.js版本14.9.0,通过它johnny five,我安装了Arduino IDE,并使用它将StandardFirmata下载到Arduino板上。我通过nano编写了一个简单的程序,然后用节点led.js运行它。然后,我收到了以下错误消息: inter

我对这一点相当陌生,如果答案显而易见,我很抱歉。我正在尝试编程一个Arduino Uno板,使其通过node.js和Raspberry Pi 3b+上的johnny five(使用rpi作为桌面)连接到的试验板上的LED亮起。我安装了node.js版本14.9.0,通过它johnny five,我安装了Arduino IDE,并使用它将StandardFirmata下载到Arduino板上。我通过nano编写了一个简单的程序,然后用
节点led.js
运行它。然后,我收到了以下错误消息:

internal/modules/cjs/loader.js:895
  throw err;
  ^

Error: Cannot find module 'johnny_five'
Require stack:
- /home/pi/led.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:892:15)
    at Function.Module._load (internal/modules/cjs/loader.js:742:27)
    at Module.require (internal/modules/cjs/loader.js:964:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/home/pi/led.js:1:12)
    at Module._compile (internal/modules/cjs/loader.js:1075:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1096:10)
    at Module.load (internal/modules/cjs/loader.js:940:32)
    at Function.Module._load (internal/modules/cjs/loader.js:781:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/home/pi/led.js' ]
}
internal/modules/cjs/loader.js:895
犯错误;
^
错误:找不到模块“johnny_five”
需要堆栈:
-/home/pi/led.js
位于Function.Module.\u resolveFilename(internal/modules/cjs/loader.js:892:15)
at Function.Module._load(内部/modules/cjs/loader.js:742:27)
at Module.require(内部/modules/cjs/loader.js:964:19)
根据需要(内部/modules/cjs/helpers.js:88:18)
反对。(/home/pi/led.js:1:12)
at模块编译(内部/modules/cjs/loader.js:1075:30)
at Object.Module._extensions..js(internal/modules/cjs/loader.js:1096:10)
在Module.load(内部/modules/cjs/loader.js:940:32)
at Function.Module._load(内部/modules/cjs/loader.js:781:14)
在Function.executeUserEntryPoint[作为runMain](internal/modules/run_main.js:72:12){
代码:“未找到模块”,
requireStack:['/home/pi/led.js']
}
知道为什么吗?非常感谢您的帮助。谢谢

之后的输出:

1598748959407 Connected /dev/ttyAMA0  
1598748969413 Device or Firmware Error A timeout occurred while connecting to the Board. 

Please check that you've properly flashed the board with the correct firmware.
See: https://github.com/rwaldron/johnny-five/wiki/Getting-Started#trouble-shooting

If connecting to a Leonardo or Leonardo clone, press the 'Reset' button on the board, wait approximately 11 seconds for complete reset, then run your program again.  
events.js:305
    throw err; // Unhandled 'error' event
    ^

Error [ERR_UNHANDLED_ERROR]: Unhandled error. ({
  type: 'error',
  timestamp: 1598748969413,
  class: 'Device or Firmware Error',
  message: 'A timeout occurred while connecting to the Board. \n' +
    '\n' +
    "Please check that you've properly flashed the board with the correct firmware.\n" +
    'See: https://github.com/rwaldron/johnny-five/wiki/Getting-Started#trouble-shooting\n' +
    '\n' +
    "If connecting to a Leonardo or Leonardo clone, press the 'Reset' button on the board, wait approximately 11 seconds for complete reset, then run your program again.",
  data: null
})
    at Board.emit (events.js:303:17)
    at Board.EventEmitter.emit (domain.js:486:12)
    at Board.log (/home/pi/johnny-five/lib/board.js:642:8)
    at Board.<computed> [as error] (/home/pi/johnny-five/lib/board.js:653:14)
    at Timeout._onTimeout (/home/pi/johnny-five/lib/board.js:384:14)
    at listOnTimeout (internal/timers.js:554:17)
    at processTimers (internal/timers.js:497:7) {
  code: 'ERR_UNHANDLED_ERROR',
  context: {
    type: 'error',
    timestamp: 1598748969413,
    class: 'Device or Firmware Error',
    message: 'A timeout occurred while connecting to the Board. \n' +
      '\n' +
      "Please check that you've properly flashed the board with the correct firmware.\n" +
      'See: https://github.com/rwaldron/johnny-five/wiki/Getting-Started#trouble-shooting\n' +
      '\n' +
      "If connecting to a Leonardo or Leonardo clone, press the 'Reset' button on the board, wait approximately 11 seconds for complete reset, then run your program again.",
    data: null
  }
}
1598748959407已连接/dev/ttyam0
1598748969413设备或固件错误连接到板时发生超时。
请检查您是否已使用正确的固件正确闪存了电路板。
见:https://github.com/rwaldron/johnny-five/wiki/Getting-Started#trouble-射击
如果连接到Leonardo或Leonardo克隆,请按电路板上的“重置”按钮,等待大约11秒以完成重置,然后再次运行程序。
events.js:305
抛出错误;//未处理的“错误”事件
^
错误[错误未处理错误]:未处理的错误。({
键入:“错误”,
时间戳:1598748969413,
类:“设备或固件错误”,
消息:“连接到线路板时发生超时。\n”+
“\n”+
“请检查您是否已使用正确的固件正确闪存了电路板。\n”+
“见:https://github.com/rwaldron/johnny-five/wiki/Getting-Started#trouble-射击\n'+
“\n”+
“如果连接到Leonardo或Leonardo克隆,请按电路板上的“重置”按钮,等待大约11秒以完成重置,然后再次运行程序。”,
数据:空
})
在Board.emit(events.js:303:17)
位于Board.EventEmitter.emit(domain.js:486:12)
在Board.log(/home/pi/johnny-five/lib/Board.js:642:8)
在船上。[作为错误](/home/pi/johnny-five/lib/board.js:653:14)
超时。_onTimeout(/home/pi/johnny-five/lib/board.js:384:14)
在listOnTimeout(internal/timers.js:554:17)
在processTimers(internal/timers.js:497:7){
代码:“ERR\u UNHANDLED\u ERROR”,
背景:{
键入:“错误”,
时间戳:1598748969413,
类:“设备或固件错误”,
消息:“连接到线路板时发生超时。\n”+
“\n”+
“请检查您是否已使用正确的固件正确闪存了电路板。\n”+
“见:https://github.com/rwaldron/johnny-five/wiki/Getting-Started#trouble-射击\n'+
“\n”+
“如果连接到Leonardo或Leonardo克隆,请按电路板上的“重置”按钮,等待大约11秒以完成重置,然后再次运行程序。”,
数据:空
}
}

你也可以在这里发布led.js吗?确保它是
require(“johnny five”)
,而不是
require(“johnny five”)
。这里是led.js:``var five=require(“johnny five”);var board=new-five.board({Port://dev/tty/ACM0});on(“ready”,function(){var-led=new-five.led(3);led.blink(500);})```@danneu解决了这个问题(谢谢!),但现在是输出:输出在我的postCan中。请也在这里发布led.js?确保它是
require(“johnny-five”)
,而不是
require(“johnny-five”)
。这里是led.js:`var-five=require(“johnny-five”);var board=new-five.board({Port://dev/tty/ACM0});on(“ready”,function(){var-led=new-five.led(3);led.blink(500);})```@danneu解决了这个问题(谢谢!),但现在是输出:输出在我的帖子中