2012-03-04 114 views
1

我對nodeJS相當陌生,我試圖使用節點軟件包管理器(NPM)安裝名爲inotify的軟件包。使用NPM安裝Inotify

安裝NPM(在OSX獅子)後,我試着用命令安裝inotify的:

sudo npm install inotify

而且我得到以下錯誤:

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 

誰能幫我這

回答

4

inotify模塊不會生成,因爲它找不到inotify_init。這是因爲inotify的不可用在OS X

在OS X上的FSEvents API提供類似的功能,但它是一個完全不同的API。 inotify模塊在這種情況下不起作用。

取決於你正在嘗試做的,fs.watch可能會滿足您的需求。它抽象了平臺的差異:

  • 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 .