1

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 epoll@0.1.12 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: epoll@0.1.12 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 epoll@0.1.12
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! code ELIFECYCLE

npm ERR! epoll@0.1.12 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the epoll@0.1.12 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 epoll@0.1.12
npm info uninstall epoll@0.1.12
npm verb unbuild rmStuff epoll@0.1.12 from /usr/local/lib/node_modules
npm verb unbuild rmStuff in /usr/local/lib/node_modules/onoff/node_modules
npm info postuninstall epoll@0.1.12
npm verb gentlyRm vacuuming /usr/local/lib/node_modules/onoff/node_modules/epoll
npm verb unbuild lib/node_modules/onoff
npm info preuninstall onoff@1.0.2
npm info uninstall onoff@1.0.2
npm verb unbuild rmStuff onoff@1.0.2 from /usr/local/lib/node_modules
npm info postuninstall onoff@1.0.2
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? – Steve Robillard Feb 27 '15 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 '15 at 18:31
  • my node -v is v0.12.0 – Txugo Feb 27 '15 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 – Steve Robillard Feb 27 '15 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 '15 at 19:30
2

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

  enum WriteOptions {
    NO_OPTIONS = 0,
    HINT_MANY_WRITES_EXPECTED = 1,
    NO_NULL_TERMINATION = 2,
    PRESERVE_ASCII_NULL = 4
  };

with this:

  enum WriteOptions {
    NO_OPTIONS = 0,
    HINT_MANY_WRITES_EXPECTED = 1,
    NO_NULL_TERMINATION = 2,
    PRESERVE_ASCII_NULL = 4,
    REPLACE_INVALID_UTF8 = 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:)

1

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 '15 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 '15 at 0:48
0

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, privacy policy and cookie policy

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