I'm trying to use the johnny-five Node.js framework with raspi-io to do a hello world example based on this tutorial. Here's my code:

var five = require("johnny-five");
var Raspi = require("raspi-io");
var board = new five.Board({
  io: new Raspi()

board.on("ready", function() {
  console.log( "Board ready." );

When I run it, I get the following error:

Error: Command failed: modprobe i2c-dev
/bin/sh: 1: modprobe: not found

  at checkExecSyncError (child_process.js:1339:13)
  at execSync (child_process.js:1379:13)
  at new I2C (/home/pi/sandbox/node_modules/raspi-io/node_modules/raspi-i2c/lib/index.js:122:5)
  at /home/pi/sandbox/node_modules/raspi-io/lib/index.js:154:16
  at new Raspi (/home/pi/sandbox/node_modules/raspi-io/lib/index.js:189:7)
  at Object.<anonymous> (/home/pi/sandbox/button.js:4:7)

I've enabled SPI and I2C in raspi-config, although I'm not sure if that is related. Running modprobe i2c-dev confirms that modprobe does not exist. Am I missing something? I've also tried reinstalling module-init-tools, as suggested in this non-raspi thread: modprobe not found at all.

  • Which version of the Pi did the tutorial use and which version are you using? Commented Aug 23, 2015 at 22:15
  • The tutorial doesn't specify but the illustration shows a Model 2 v1.1 – I'm using a Model A+ V1.1. Commented Aug 23, 2015 at 23:11

1 Answer 1


modprobe is not in a standard user's path as it is not runnable as a standard user. It requires superuser privileges to run.

If you use the command sudo modprobe the command will be found. sudo which modprobe will show its location, normally /sbin/modprobe.

Try launching the script using sudo, i.e. precede the command you use to launch the script with sudo.

  • Thank you! sudo node example.js works correctly. Is this common for raspberry pi scripting? I usually avoid executing with sudo (in the web development world) for security reasons. Commented Aug 22, 2015 at 17:36
  • It's unavoidable if the script uses commands which require superuser privileges to run (such as modprobe). In this instance a safer alternative would be to add i2c-dev to /etc/modules so that it will be loaded at boot.
    – joan
    Commented Aug 22, 2015 at 17:48
  • That makes sense, my scripts don't usually interface with hardware so it's just new to me. Thanks again. Commented Aug 22, 2015 at 17:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.