I'm trying to install npm's package onOff on my pi.

I'm running this command:

sudo npm install --unsafe-perm --verbose -g  onoff

And all I get is an error and rollback. do you know why?

gyp verb validating download checksum for node-v0.12.0.tar.gz (e24fc55d586d197ad1cdf052abedd6e7a1d4d620d75ee6d9276d761f77080fb8 == 9700e23af4e9b3643af48cef5f2ad20a1331ff531a12154eef2bfb0bb1682e32)
gyp WARN install got an error, rolling back install
gyp verb command remove [ '0.12.0' ]
gyp verb remove using node-gyp dir: /root/.node-gyp
gyp verb remove removing target version: 0.12.0
gyp verb remove removing development files for version: 0.12.0
gyp ERR! configure error
gyp ERR! stack Error: node-v0.12.0.tar.gz local checksum e24fc55d586d197ad1cdf052abedd6e7a1d4d620d75ee6d9276d761f77080fb8 not match remote 9700e23af4e9b3643af48cef5f2ad20a1331ff531a12154eef2bfb0bb1682e32
gyp ERR! stack     at deref (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/install.js:299:20)
gyp ERR! stack     at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/install.js:340:13)
gyp ERR! stack     at IncomingMessage.emit (events.js:129:20)
gyp ERR! stack     at _stream_readable.js:908:16
gyp ERR! stack     at process._tickCallback (node.js:355:11)
gyp ERR! System Linux 3.12.26-rpi-aufs
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/onoff/node_modules/epoll
gyp ERR! node -v v0.12.0
gyp ERR! node-gyp -v v1.0.2
gyp ERR! not ok
npm verb unsafe-perm in lifecycle true
npm info [email protected] Failed to exec install script
npm verb unlock done using /root/.npm/_locks/epoll-4c03fef6dbce0644.lock for /usr/local/lib/node_modules/onoff/node_modules/epoll
npm verb about to build /usr/local/lib/node_modules/onoff
npm verb unlock done using /root/.npm/_locks/onoff-f2713974fa0ced28.lock for /usr/local/lib/node_modules/onoff
npm verb stack Error: [email protected] install: `node-gyp rebuild`
npm verb stack Exit status 1
npm verb stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:213:16)
npm verb stack     at EventEmitter.emit (events.js:110:17)
npm verb stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:14:12)
npm verb stack     at ChildProcess.emit (events.js:110:17)
npm verb stack     at maybeClose (child_process.js:1008:16)
npm verb stack     at Process.ChildProcess._handle.onexit (child_process.js:1080:5)
npm verb pkgid [email protected]
npm verb cwd /usr/share/adafruit/webide/repositories/my-pi-projects/Adafruit_DHT_Driver_Python/build/lib.linux-armv6l-2.7/PushNotifications
npm ERR! Linux 3.12.26-rpi-aufs
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "--unsafe-perm" "--verbose" "-g" "onoff"
npm ERR! node v0.12.0
npm ERR! npm  v2.5.1

npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the epoll package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls epoll
npm ERR! There is likely additional logging output above.
npm verb exit [ 1, true ]
npm verb unbuild lib/node_modules/onoff/node_modules/epoll
npm info preuninstall [email protected]
npm info uninstall [email protected]
npm verb unbuild rmStuff [email protected] from /usr/local/lib/node_modules
npm verb unbuild rmStuff in /usr/local/lib/node_modules/onoff/node_modules
npm info postuninstall [email protected]
npm verb gentlyRm vacuuming /usr/local/lib/node_modules/onoff/node_modules/epoll
npm verb unbuild lib/node_modules/onoff
npm info preuninstall [email protected]
npm info uninstall [email protected]
npm verb unbuild rmStuff [email protected] from /usr/local/lib/node_modules
npm info postuninstall [email protected]
npm verb gentlyRm vacuuming /usr/local/lib/node_modules/onoff

npm ERR! Please include the following file with any support request:
npm ERR!     /usr/share/adafruit/webide/repositories/my-pi-projects/Adafruit_DHT_Driver_Python/build/lib.linux-armv6l-2.7/PushNotifications/npm-debug.log
  • How did you install node? Feb 27, 2015 at 17:39
  • I did wget node-arm.herokuapp.com/node_latest_armhf.deb and sudo dpkg -i node_latest_armhf.deb was that correct?
    – Txugo
    Feb 27, 2015 at 18:31
  • my node -v is v0.12.0
    – Txugo
    Feb 27, 2015 at 18:32
  • what happens if you run this npm install onoff --save? if that does not work try this npm install -g node-gyp then npm install onoff --save. you may need to run these as root Feb 27, 2015 at 18:58
  • after npm install -g node-gyp npm install onoff --save fails for the same reason. seems like a problem with the epoll package (onoff dependency)
    – Txugo
    Feb 28, 2015 at 19:30

3 Answers 3


Check usr/include/nodejs/deps/v8/include/v8.h and replace the following:

  enum WriteOptions {
    NO_OPTIONS = 0,

with this:

  enum WriteOptions {
    NO_OPTIONS = 0,

then try npm install again

Had similar problems while trying to install "onoff" package in my Pi 2. This thread helped me solving the problem.

My particular issue was the following: I needed onoff for tinkering with GPIO. epoll is a dependency for it but npm couldn't install the latest version (0.1.16 at the time when I am writing this) for some reason. At the same time, no matter how I tried to get npm to install 0.1.13 instead (tried everything in package.json) npm just didn't care, still tried the latest one. The link above explained a lot and helped me to get npm to do what he was told:)


In case anyone comes across this question, I installed the Adafruit port of Node specifically for RPI following this guide (node -v 0.12.0 and Pi1 - B+): https://learn.adafruit.com/node-embedded-development/installing-node-dot-js

I had similar error output with npm install onoff, but sudo npm install onoff fixed the issue

  • thanks for your reply. but what is your pi's version? is it the very first pi1 B model? I did sudo npm install --unsafe-perm --verbose -g onoff which is basically the same as the sudo npm install with more log info and ignores some warnings along the way. only did that because the other one didn't work.
    – Txugo
    May 17, 2015 at 20:50
  • Oh, I'm using the Pi1 B+, which might make the difference. Have you had trouble installing other NPM modules? Would you mind posting the npm_debug log as well?
    – KyleKing
    May 20, 2015 at 0:48

It turns out that the issue was related to berryboot. After reinstalling raspbian without berryboot it all worked fine. For more info have a look at this ticket

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.