Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Installing Inotify with NPM

Installing Inotify with NPM

Problem

I'm quite new to nodeJS and I'm trying to install a package called Inotify using the Node Package Manager (NPM).

After installing NPM (on OSX Lion), I tried to install inotify with the command:

sudo npm install inotify

And I get the following error:

npm http GET https://registry.npmjs.org/inotify
npm http 304 https://registry.npmjs.org/inotify

> [email protected] install /usr/local/lib/node_modules/inotify
> node-waf configure build

Checking for program g++ or c++          : /usr/bin/g++ 
Checking for program cpp                 : /usr/bin/cpp 
Checking for program ar                  : /usr/bin/ar 
Checking for program ranlib              : /usr/bin/ranlib 
Checking for g++                         : ok  
Checking for node path                   : not found 
Checking for node prefix                 : ok /usr/local/Cellar/node/0.6.6 
Checking for program node                : /usr/local/bin/node 
Checking for function inotify_init       : not found 
/usr/local/lib/node_modules/inotify/src/wscript:11: error: the configuration failed (see '/usr/local/lib/node_modules/inotify/build/config.log')
npm ERR! error installing [email protected]

npm ERR! [email protected] install: `node-waf configure build`
npm ERR! `sh "-c" "node-waf configure build"` failed with 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the inotify package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-waf configure build
npm ERR! You can get their info via:
npm ERR!     npm owner ls inotify
npm ERR! There is likely additional logging output above.
npm ERR! 
npm ERR! System Darwin 11.2.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "inotify"
npm ERR! cwd /Users/username/code
npm ERR! node -v v0.6.6
npm ERR! npm -v 1.1.4
npm ERR! code ELIFECYCLE
npm ERR! message [email protected] install: `node-waf configure build`
npm ERR! message `sh "-c" "node-waf configure build"` failed with 1
npm ERR! errno {}
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/username/code/npm-debug.log
npm not ok

Can someone help me out with this

Problem courtesy of: matsko

Solution

The inotify module won't build because it can't find inotify_init. This is because inotify is not available on OS X.

The FSEvents API on OS X provides similar functionality, but it's a completely different API. The inotify module is not going to work in this situation.

Depending on what you are trying to do, fs.watch might suit your needs. It abstracts away platform differences:

  • On Linux systems, this uses inotify.
  • On BSD systems (including OS X), this uses kqueue.
  • On SunOS systems (including Solaris and SmartOS), this uses event ports.
  • On Windows systems, this feature depends on ReadDirectoryChangesW.
Solution courtesy of: Rohan Singh

Discussion

View additional discussion.



This post first appeared on Node.js Recipes, please read the originial post: here

Share the post

Installing Inotify with NPM

×

Subscribe to Node.js Recipes

Get updates delivered right to your inbox!

Thank you for your subscription

×