Skip to content

Instantly share code, notes, and snippets.

@a5sk4s
Last active August 29, 2015 13:55
Show Gist options
  • Save a5sk4s/8757571 to your computer and use it in GitHub Desktop.
Save a5sk4s/8757571 to your computer and use it in GitHub Desktop.
fsevent install issue on mac os x 10.6.8
$ npm install <path_to_fsevents>/
> fsevents@0.2.0 install <path_to_project>/node_modules/fsevents
> node-gyp rebuild
CXX(target) Release/obj.target/fse/fsevents.o
In file included from ../fsevents.cc:81:
../src/thread.cc: In static member function ‘static void* fse::FSEvents::threadRun(void*)’:
../src/thread.cc:30: error: ‘kFSEventStreamCreateFlagFileEvents’ was not declared in this scope
In file included from ../fsevents.cc:82:
../src/constants.cc: In function ‘v8::Handle<v8::Object> Constants()’:
../src/constants.cc:18: error: ‘kFSEventStreamEventFlagItemCreated’ was not declared in this scope
../src/constants.cc:19: error: ‘kFSEventStreamEventFlagItemRemoved’ was not declared in this scope
../src/constants.cc:20: error: ‘kFSEventStreamEventFlagItemInodeMetaMod’ was not declared in this scope
../src/constants.cc:21: error: ‘kFSEventStreamEventFlagItemRenamed’ was not declared in this scope
../src/constants.cc:22: error: ‘kFSEventStreamEventFlagItemModified’ was not declared in this scope
../src/constants.cc:23: error: ‘kFSEventStreamEventFlagItemFinderInfoMod’ was not declared in this scope
../src/constants.cc:24: error: ‘kFSEventStreamEventFlagItemChangeOwner’ was not declared in this scope
../src/constants.cc:25: error: ‘kFSEventStreamEventFlagItemXattrMod’ was not declared in this scope
../src/constants.cc:26: error: ‘kFSEventStreamEventFlagItemIsFile’ was not declared in this scope
../src/constants.cc:27: error: ‘kFSEventStreamEventFlagItemIsDir’ was not declared in this scope
../src/constants.cc:28: error: ‘kFSEventStreamEventFlagItemIsSymlink’ was not declared in this scope
make: *** [Release/obj.target/fse/fsevents.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/Cellar/node/0.10.25/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Darwin 10.8.0
gyp ERR! command "node" "/usr/local/Cellar/node/0.10.25/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd <path_to_project>/node_modules/fsevents
gyp ERR! node -v v0.10.25
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok
npm ERR! fsevents@0.2.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the fsevents@0.2.0 install script.
npm ERR! This is most likely a problem with the fsevents 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 fsevents
npm ERR! There is likely additional logging output above.
npm ERR! System Darwin 10.8.0
npm ERR! command "/usr/local/Cellar/node/0.10.25/bin/node" "/usr/local/bin/npm" "install" "<path_to_fsevents>/"
npm ERR! cwd <path_to_project>
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.24
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! <path_to_project>/npm-debug.log
npm ERR! not ok code 0
$ cat npm-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/Cellar/node/0.10.25/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'install',
1 verbose cli '<path>/fsevents/' ]
2 info using npm@1.3.24
3 info using node@v0.10.25
4 verbose cache add [ '<path>/fsevents/', null ]
5 verbose cache add name=undefined spec="<path>/fsevents/" args=["<path>/fsevents/",null]
6 verbose parsed url { protocol: null,
6 verbose parsed url slashes: null,
6 verbose parsed url auth: null,
6 verbose parsed url host: null,
6 verbose parsed url port: null,
6 verbose parsed url hostname: null,
6 verbose parsed url hash: null,
6 verbose parsed url search: null,
6 verbose parsed url query: null,
6 verbose parsed url pathname: '<path>/fsevents/',
6 verbose parsed url path: '<path>/fsevents/',
6 verbose parsed url href: '<path>/fsevents/' }
7 silly lockFile f0d318ae-... <path>/fsevents/
8 verbose lock <path>/fsevents/ <home>/.npm/f0d318ae-....lock
9 verbose tar pack [ '/var/folders/rw/rw1quTqkG0OG+Z3EziQH+k+++TI/-Tmp-/npm-70805-f0lVf5ZK/1391281875826-0.219105651602149/tmp.tgz',
9 verbose tar pack '<path>/fsevents/' ]
10 verbose tarball /var/folders/rw/rw1quTqkG0OG+Z3EziQH+k+++TI/-Tmp-/npm-70805-f0lVf5ZK/1391281875826-0.219105651602149/tmp.tgz
11 verbose folder <path>/fsevents/
12 info prepublish fsevents@0.2.0
13 silly lockFile a7484748-... tar://<path>/fsevents/
14 verbose lock tar://<path>/fsevents/ <home>/.npm/a7484748-....lock
15 silly lockFile 10981c1f-... tar:///var/folders/rw/rw1quTqkG0OG+Z3EziQH+k+++TI/-Tmp-/npm-70805-f0lVf5ZK/1391281875826-0.219105651602149/tmp.tgz
16 verbose lock tar:///var/folders/rw/rw1quTqkG0OG+Z3EziQH+k+++TI/-Tmp-/npm-70805-f0lVf5ZK/1391281875826-0.219105651602149/tmp.tgz <home>/.npm/10981c1f-....lock
17 silly lockFile a7484748-... tar://<path>/fsevents/
18 silly lockFile a7484748-... tar://<path>/fsevents/
19 silly lockFile 10981c1f-... tar:///var/folders/rw/rw1quTqkG0OG+Z3EziQH+k+++TI/-Tmp-/npm-70805-f0lVf5ZK/1391281875826-0.219105651602149/tmp.tgz
20 silly lockFile 10981c1f-... tar:///var/folders/rw/rw1quTqkG0OG+Z3EziQH+k+++TI/-Tmp-/npm-70805-f0lVf5ZK/1391281875826-0.219105651602149/tmp.tgz
21 verbose tar unpack /var/folders/rw/rw1quTqkG0OG+Z3EziQH+k+++TI/-Tmp-/npm-70805-f0lVf5ZK/1391281875826-0.219105651602149/tmp.tgz
22 silly lockFile 911f797c-... tar:///var/folders/rw/rw1quTqkG0OG+Z3EziQH+k+++TI/-Tmp-/npm-70805-f0lVf5ZK/1391281875826-0.219105651602149/package
23 verbose lock tar:///var/folders/rw/rw1quTqkG0OG+Z3EziQH+k+++TI/-Tmp-/npm-70805-f0lVf5ZK/1391281875826-0.219105651602149/package <home>/.npm/911f797c-....lock
24 silly lockFile 10981c1f-... tar:///var/folders/rw/rw1quTqkG0OG+Z3EziQH+k+++TI/-Tmp-/npm-70805-f0lVf5ZK/1391281875826-0.219105651602149/tmp.tgz
25 verbose lock tar:///var/folders/rw/rw1quTqkG0OG+Z3EziQH+k+++TI/-Tmp-/npm-70805-f0lVf5ZK/1391281875826-0.219105651602149/tmp.tgz <home>/.npm/10981c1f-....lock
26 silly gunzTarPerm modes [ '755', '644' ]
27 silly gunzTarPerm extractEntry package.json
28 silly gunzTarPerm extractEntry .npmignore
29 silly gunzTarPerm extractEntry LICENSE
30 silly gunzTarPerm extractEntry fsevents.js
31 silly gunzTarPerm extractEntry CHANGELOG.md
32 silly gunzTarPerm extractEntry Readme.md
33 silly gunzTarPerm extractEntry binding.gyp
34 silly gunzTarPerm extractEntry fsevents.cc
35 silly gunzTarPerm extractEntry src/async.cc
36 silly gunzTarPerm extractEntry src/constants.cc
37 silly gunzTarPerm extractEntry src/locking.cc
38 silly gunzTarPerm extractEntry src/methods.cc
39 silly gunzTarPerm extractEntry src/storage.cc
40 silly gunzTarPerm extractEntry src/thread.cc
41 silly gunzTarPerm extractEntry test/fsevents.js
42 silly gunzTarPerm extractEntry test/function.js
43 silly lockFile 911f797c-... tar:///var/folders/rw/rw1quTqkG0OG+Z3EziQH+k+++TI/-Tmp-/npm-70805-f0lVf5ZK/1391281875826-0.219105651602149/package
44 silly lockFile 911f797c-... tar:///var/folders/rw/rw1quTqkG0OG+Z3EziQH+k+++TI/-Tmp-/npm-70805-f0lVf5ZK/1391281875826-0.219105651602149/package
45 silly lockFile 10981c1f-... tar:///var/folders/rw/rw1quTqkG0OG+Z3EziQH+k+++TI/-Tmp-/npm-70805-f0lVf5ZK/1391281875826-0.219105651602149/tmp.tgz
46 silly lockFile 10981c1f-... tar:///var/folders/rw/rw1quTqkG0OG+Z3EziQH+k+++TI/-Tmp-/npm-70805-f0lVf5ZK/1391281875826-0.219105651602149/tmp.tgz
47 verbose tar pack [ '<home>/.npm/fsevents/0.2.0/package.tgz',
47 verbose tar pack '/var/folders/rw/rw1quTqkG0OG+Z3EziQH+k+++TI/-Tmp-/npm-70805-f0lVf5ZK/1391281875826-0.219105651602149/package' ]
48 verbose tarball <home>/.npm/fsevents/0.2.0/package.tgz
49 verbose folder /var/folders/rw/rw1quTqkG0OG+Z3EziQH+k+++TI/-Tmp-/npm-70805-f0lVf5ZK/1391281875826-0.219105651602149/package
50 silly lockFile 911f797c-... tar:///var/folders/rw/rw1quTqkG0OG+Z3EziQH+k+++TI/-Tmp-/npm-70805-f0lVf5ZK/1391281875826-0.219105651602149/package
51 verbose lock tar:///var/folders/rw/rw1quTqkG0OG+Z3EziQH+k+++TI/-Tmp-/npm-70805-f0lVf5ZK/1391281875826-0.219105651602149/package <home>/.npm/911f797c-....lock
52 silly lockFile 12ab780f-... tar://<home>/.npm/fsevents/0.2.0/package.tgz
53 verbose lock tar://<home>/.npm/fsevents/0.2.0/package.tgz <home>/.npm/12ab780f-....lock
54 silly lockFile 911f797c-... tar:///var/folders/rw/rw1quTqkG0OG+Z3EziQH+k+++TI/-Tmp-/npm-70805-f0lVf5ZK/1391281875826-0.219105651602149/package
55 silly lockFile 911f797c-... tar:///var/folders/rw/rw1quTqkG0OG+Z3EziQH+k+++TI/-Tmp-/npm-70805-f0lVf5ZK/1391281875826-0.219105651602149/package
56 silly lockFile 12ab780f-... tar://<home>/.npm/fsevents/0.2.0/package.tgz
57 silly lockFile 12ab780f-... tar://<home>/.npm/fsevents/0.2.0/package.tgz
58 silly lockFile 868ee857-... <home>/.npm/fsevents/0.2.0/package
59 verbose lock <home>/.npm/fsevents/0.2.0/package <home>/.npm/868ee857-....lock
60 silly lockFile 868ee857-... <home>/.npm/fsevents/0.2.0/package
61 silly lockFile 868ee857-... <home>/.npm/fsevents/0.2.0/package
62 verbose tar unpack <home>/.npm/fsevents/0.2.0/package.tgz
63 silly lockFile b345c0e5-... tar://<home>/.npm/fsevents/0.2.0/package
64 verbose lock tar://<home>/.npm/fsevents/0.2.0/package <home>/.npm/b345c0e5-....lock
65 silly lockFile 12ab780f-... tar://<home>/.npm/fsevents/0.2.0/package.tgz
66 verbose lock tar://<home>/.npm/fsevents/0.2.0/package.tgz <home>/.npm/12ab780f-....lock
67 silly gunzTarPerm modes [ '755', '644' ]
68 silly gunzTarPerm extractEntry package.json
69 silly gunzTarPerm extractEntry .npmignore
70 silly gunzTarPerm extractEntry LICENSE
71 silly gunzTarPerm extractEntry fsevents.js
72 silly gunzTarPerm extractEntry CHANGELOG.md
73 silly gunzTarPerm extractEntry Readme.md
74 silly gunzTarPerm extractEntry binding.gyp
75 silly gunzTarPerm extractEntry fsevents.cc
76 silly gunzTarPerm extractEntry src/async.cc
77 silly gunzTarPerm extractEntry src/constants.cc
78 silly gunzTarPerm extractEntry src/locking.cc
79 silly gunzTarPerm extractEntry src/methods.cc
80 silly gunzTarPerm extractEntry src/storage.cc
81 silly gunzTarPerm extractEntry src/thread.cc
82 silly gunzTarPerm extractEntry test/fsevents.js
83 silly gunzTarPerm extractEntry test/function.js
84 silly lockFile b345c0e5-... tar://<home>/.npm/fsevents/0.2.0/package
85 silly lockFile b345c0e5-... tar://<home>/.npm/fsevents/0.2.0/package
86 silly lockFile 12ab780f-... tar://<home>/.npm/fsevents/0.2.0/package.tgz
87 silly lockFile 12ab780f-... tar://<home>/.npm/fsevents/0.2.0/package.tgz
88 verbose chmod <home>/.npm/fsevents/0.2.0/package.tgz 644
89 verbose chown <home>/.npm/fsevents/0.2.0/package.tgz [ 501, 20 ]
90 silly lockFile f0d318ae-... <path>/fsevents/
91 silly lockFile f0d318ae-... <path>/fsevents/
92 silly resolved [ { name: 'fsevents',
92 silly resolved version: '0.2.0',
92 silly resolved description: 'Native Access to Mac OS-X FSEvents',
92 silly resolved main: 'fsevents.js',
92 silly resolved dependencies: { nan: '~0.8.0' },
92 silly resolved os: [ 'darwin' ],
92 silly resolved engines: { node: '>=0.8.0' },
92 silly resolved scripts:
92 silly resolved { install: 'node-gyp rebuild',
92 silly resolved test: 'export PATH=$PATH:`pwd`/node_nodules/.bin/ && tap ./test' },
92 silly resolved repository:
92 silly resolved { type: 'git',
92 silly resolved url: 'https://github.com/pipobscure/fsevents.git' },
92 silly resolved keywords: [ 'fsevents', 'mac' ],
92 silly resolved author: { name: 'Philipp Dunkel', email: 'pip@pipobscure.com' },
92 silly resolved license: 'MIT',
92 silly resolved gypfile: true,
92 silly resolved bugs: { url: 'https://github.com/pipobscure/fsevents/issues' },
92 silly resolved homepage: 'https://github.com/pipobscure/fsevents',
92 silly resolved devDependencies: { tap: '~0.4.8' },
92 silly resolved readme: '# FSEvents [![NPM](https://nodei.co/npm/fsevents.png)](https://nodei.co/npm/fsevents/)\n## Native Access to Mac OS-X FSEvents\n\n * [Node.js](http://nodejs.org/)\n * [Github repo](https://github.com/pipobscure/fsevents.git)\n * [Module Site](https://github.com/pipobscure/fsevents)\n * [NPM Page](https://npmjs.org/package/fsevents)\n\n## Installation\n\n\t$ npm install -g node-gyp\n\t$\tgit clone https://github.com/pipobscure/fsevents.git fsevents\n\t$ cd fsevents\n\t$ node-gyp configure build\n\nOR SIMPLY\n\n\t$ npm install fsevents\n\n## Usage\n\n var fsevents = require(\'fsevents\');\n var watcher = fsevents(__dirname);\n watcher.on(\'fsevent\', function(path, flags, id) { }); // RAW Event as emitted by OS-X\n watcher.on(\'change\', function(path, info) {}); // Common Event for all changes\n // To end observation\n\n### Events\n\n * *fsevent* - RAW Event as emitted by OS-X\n * *change* - Common Event for all changes\n * *created* - A File-System-Item has been created\n * *deleted* - A File-System-Item has been deleted\n * *modified* - A File-System-Item has been modified\n * *moved-out* - A File-System-Item has been moved away from this location\n * *moved-in* - A File-System-Item has been moved into this location\n\nAll events except *fsevent* take an *info* object as the second parameter of the callback. The structure of this object is:\n\n {\n "event": "<event-type>",\n "id": <eventi-id>,\n "path": "<path-that-this-is-about>",\n "type": "<file|directory|symlink>",\n "changes": {\n "inode": true, // Has the iNode Meta-Information changed\n "finder": false, // Has the Finder Meta-Data changed\n "access": false, // Have the access permissions changed\n "xattrs": false // Have the xAttributes changed\n },\n "flags": <raw-flags>\n }\n\n## MIT License\n\nCopyright (C) 2010-2014 Philipp Dunkel\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the "Software"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n',
92 silly resolved readmeFilename: 'Readme.md',
92 silly resolved _id: 'fsevents@0.2.0',
92 silly resolved dist: { shasum: '15bbd36ba7264e227e9291d121b692e8f24fc263' },
92 silly resolved _from: '<path>/fsevents/' } ]
93 info install fsevents@0.2.0 into <path>/<project>
94 info installOne fsevents@0.2.0
95 info <path>/<project>/node_modules/fsevents unbuild
96 verbose tar unpack <home>/.npm/fsevents/0.2.0/package.tgz
97 silly lockFile 45578301-... tar://<path>/<project>/node_modules/fsevents
98 verbose lock tar://<path>/<project>/node_modules/fsevents <home>/.npm/45578301-....lock
99 silly lockFile 12ab780f-... tar://<home>/.npm/fsevents/0.2.0/package.tgz
100 verbose lock tar://<home>/.npm/fsevents/0.2.0/package.tgz <home>/.npm/12ab780f-....lock
101 silly gunzTarPerm modes [ '755', '644' ]
102 silly gunzTarPerm extractEntry package.json
103 silly gunzTarPerm extractEntry .npmignore
104 silly gunzTarPerm extractEntry LICENSE
105 silly gunzTarPerm extractEntry fsevents.js
106 silly gunzTarPerm extractEntry CHANGELOG.md
107 silly gunzTarPerm extractEntry Readme.md
108 silly gunzTarPerm extractEntry binding.gyp
109 silly gunzTarPerm extractEntry fsevents.cc
110 silly gunzTarPerm extractEntry src/async.cc
111 silly gunzTarPerm extractEntry src/constants.cc
112 silly gunzTarPerm extractEntry src/locking.cc
113 silly gunzTarPerm extractEntry src/methods.cc
114 silly gunzTarPerm extractEntry src/storage.cc
115 silly gunzTarPerm extractEntry src/thread.cc
116 silly gunzTarPerm extractEntry test/fsevents.js
117 silly gunzTarPerm extractEntry test/function.js
118 silly lockFile 45578301-... tar://<path>/<project>/node_modules/fsevents
119 silly lockFile 45578301-... tar://<path>/<project>/node_modules/fsevents
120 silly lockFile 12ab780f-... tar://<home>/.npm/fsevents/0.2.0/package.tgz
121 silly lockFile 12ab780f-... tar://<home>/.npm/fsevents/0.2.0/package.tgz
122 info preinstall fsevents@0.2.0
123 verbose readDependencies using package.json deps
124 verbose readDependencies using package.json deps
125 verbose cache add [ 'nan@~0.8.0', null ]
126 verbose cache add name=undefined spec="nan@~0.8.0" args=["nan@~0.8.0",null]
127 verbose parsed url { protocol: null,
127 verbose parsed url slashes: null,
127 verbose parsed url auth: null,
127 verbose parsed url host: null,
127 verbose parsed url port: null,
127 verbose parsed url hostname: null,
127 verbose parsed url hash: null,
127 verbose parsed url search: null,
127 verbose parsed url query: null,
127 verbose parsed url pathname: 'nan@~0.8.0',
127 verbose parsed url path: 'nan@~0.8.0',
127 verbose parsed url href: 'nan@~0.8.0' }
128 verbose cache add name="nan" spec="~0.8.0" args=["nan","~0.8.0"]
129 verbose parsed url { protocol: null,
129 verbose parsed url slashes: null,
129 verbose parsed url auth: null,
129 verbose parsed url host: null,
129 verbose parsed url port: null,
129 verbose parsed url hostname: null,
129 verbose parsed url hash: null,
129 verbose parsed url search: null,
129 verbose parsed url query: null,
129 verbose parsed url pathname: '~0.8.0',
129 verbose parsed url path: '~0.8.0',
129 verbose parsed url href: '~0.8.0' }
130 verbose addNamed [ 'nan', '~0.8.0' ]
131 verbose addNamed [ null, '>=0.8.0-0 <0.9.0-0' ]
132 silly lockFile d5ae64ea-... nan@~0.8.0
133 verbose lock nan@~0.8.0 <home>/.npm/d5ae64ea-....lock
134 silly addNameRange { name: 'nan', range: '>=0.8.0-0 <0.9.0-0', hasData: false }
135 verbose url raw nan
136 verbose url resolving [ 'https://registry.npmjs.org/', './nan' ]
137 verbose url resolved https://registry.npmjs.org/nan
138 info trying registry request attempt 1 at 11:11:16
139 verbose etag "9UECXC57D7P4LHUYG2GZ8I49F"
140 http GET https://registry.npmjs.org/nan
141 http 304 https://registry.npmjs.org/nan
142 silly registry.get cb [ 304,
142 silly registry.get { date: 'Sat, 01 Feb 2014 19:11:16 GMT',
142 silly registry.get server: 'Apache',
142 silly registry.get connection: 'Keep-Alive',
142 silly registry.get 'keep-alive': 'timeout=10, max=50',
142 silly registry.get etag: '"9UECXC57D7P4LHUYG2GZ8I49F"',
142 silly registry.get 'cache-control': 'max-age=1',
142 silly registry.get vary: 'Accept' } ]
143 verbose etag nan from cache
144 silly addNameRange number 2 { name: 'nan', range: '>=0.8.0-0 <0.9.0-0', hasData: true }
145 silly addNameRange versions [ 'nan',
145 silly addNameRange [ '0.3.0-wip',
145 silly addNameRange '0.3.0-wip2',
145 silly addNameRange '0.3.0',
145 silly addNameRange '0.3.1',
145 silly addNameRange '0.3.2',
145 silly addNameRange '0.4.0',
145 silly addNameRange '0.4.1',
145 silly addNameRange '0.4.2',
145 silly addNameRange '0.4.3',
145 silly addNameRange '0.4.4',
145 silly addNameRange '0.5.0',
145 silly addNameRange '0.5.1',
145 silly addNameRange '0.5.2',
145 silly addNameRange '0.6.0',
145 silly addNameRange '0.7.0',
145 silly addNameRange '0.7.1',
145 silly addNameRange '0.8.0' ] ]
146 verbose addNamed [ 'nan', '0.8.0' ]
147 verbose addNamed [ '0.8.0', '0.8.0' ]
148 silly lockFile 46761758-... nan@0.8.0
149 verbose lock nan@0.8.0 <home>/.npm/46761758-....lock
150 silly lockFile 46761758-... nan@0.8.0
151 silly lockFile 46761758-... nan@0.8.0
152 silly lockFile d5ae64ea-... nan@~0.8.0
153 silly lockFile d5ae64ea-... nan@~0.8.0
154 silly resolved [ { name: 'nan',
154 silly resolved version: '0.8.0',
154 silly resolved description: 'Native Abstractions for Node.js: C++ header for Node 0.8->0.12 compatibility',
154 silly resolved main: 'include_dirs.js',
154 silly resolved repository: { type: 'git', url: 'git://github.com/rvagg/nan.git' },
154 silly resolved contributors: [ [Object], [Object], [Object], [Object], [Object], [Object] ],
154 silly resolved license: 'MIT',
154 silly resolved readme: 'Native Abstractions for Node.js\n===============================\n\n**A header file filled with macro and utility goodness for making add-on development for Node.js easier across versions 0.8, 0.10 and 0.11, and eventually 0.12.**\n\n***Current version: 0.8.0*** *(See [nan.h](https://github.com/rvagg/nan/blob/master/nan.h) for complete ChangeLog)*\n\n[![NPM](https://nodei.co/npm/nan.png?downloads=true)](https://nodei.co/npm/nan/) [![NPM](https://nodei.co/npm-dl/nan.png?months=6)](https://nodei.co/npm/nan/)\n\nThanks to the crazy changes in V8 (and some in Node core), keeping native addons compiling happily across versions, particularly 0.10 to 0.11/0.12, is a minor nightmare. The goal of this project is to store all logic necessary to develop native Node.js addons without having to inspect `NODE_MODULE_VERSION` and get yourself into a macro-tangle.\n\nThis project also contains some helper utilities that make addon development a bit more pleasant.\n\n * **[News & Updates](#news)**\n * **[Usage](#usage)**\n * **[Example](#example)**\n * **[API](#api)**\n\n<a name="news"></a>\n## News & Updates\n\n### Dec-2013: NanCString and NanRawString\n\nTwo new functions have been introduced to replace the functionality that\'s been provided by `NanFromV8String` until now. NanCString has sensible defaults so it\'s super easy to fetch a null-terminated c-style string out of a `v8::String`. `NanFromV8String` is still around and has defaults that allow you to pass a single handle to fetch a `char*` while `NanRawString` requires a little more attention to arguments.\n\n### Nov-2013: Node 0.11.9+ breaking V8 change\n\nThe version of V8 that\'s shipping with Node 0.11.9+ has changed the signature for new `Local`s to: `v8::Local<T>::New(isolate, value)`, i.e. introducing the `isolate` argument and therefore breaking all new `Local` declarations for previous versions. NAN 0.6+ now includes a `NanNewLocal<T>(value)` that can be used in place to work around this incompatibility and maintain compatibility with 0.8->0.11.9+ (minus a few early 0.11 releases).\n\nFor example, if you wanted to return a `null` on a callback you will have to change the argument from `v8::Local<v8::Value>::New(v8::Null())` to `NanNewLocal<v8::Value>(v8::Null())`.\n\n### Nov-2013: Change to binding.gyp `"include_dirs"` for NAN\n\nInclusion of NAN in a project\'s binding.gyp is now greatly simplified. You can now just use `"<!(node -e \\"require(\'nan\')\\")"` in your `"include_dirs"`, see example below (note Windows needs the quoting around `require` to be just right: `"require(\'nan\')"` with appropriate `\\` escaping).\n\n<a name="usage"></a>\n## Usage\n\nSimply add **NAN** as a dependency in the *package.json* of your Node addon:\n\n``` bash\n$ npm install --save nan\n```\n\nPull in the path to **NAN** in your *binding.gyp* so that you can use `#include "nan.h"` in your *.cpp* files:\n\n``` python\n"include_dirs" : [\n "<!(node -e \\"require(\'nan\')\\")"\n]\n```\n\nThis works like a `-I<path-to-NAN>` when compiling your addon.\n\n<a name="example"></a>\n## Example\n\nSee **[LevelDOWN](https://github.com/rvagg/node-leveldown/pull/48)** for a full example of **NAN** in use.\n\nFor a simpler example, see the **[async pi estimation example](https://github.com/rvagg/nan/tree/master/examples/async_pi_estimate)** in the examples directory for full code and an explanation of what this Monte Carlo Pi estimation example does. Below are just some parts of the full example that illustrate the use of **NAN**.\n\nCompare to the current 0.10 version of this example, found in the [node-addon-examples](https://github.com/rvagg/node-addon-examples/tree/master/9_async_work) repository and also a 0.11 version of the same found [here](https://github.com/kkoopa/node-addon-examples/tree/5c01f58fc993377a567812597e54a83af69686d7/9_async_work).\n\nNote that there is no embedded version sniffing going on here and also the async work is made much simpler, see below for details on the `NanAsyncWorker` class.\n\n```c++\n// addon.cc\n#include <node.h>\n#include "nan.h"\n// ...\n\nusing namespace v8;\n\nvoid InitAll(Handle<Object> exports) {\n exports->Set(NanSymbol("calculateSync"),\n FunctionTemplate::New(CalculateSync)->GetFunction());\n\n exports->Set(NanSymbol("calculateAsync"),\n FunctionTemplate::New(CalculateAsync)->GetFunction());\n}\n\nNODE_MODULE(addon, InitAll)\n```\n\n```c++\n// sync.h\n#include <node.h>\n#include "nan.h"\n\nNAN_METHOD(CalculateSync);\n```\n\n```c++\n// sync.cc\n#include <node.h>\n#include "nan.h"\n#include "sync.h"\n// ...\n\nusing namespace v8;\n\n// Simple synchronous access to the `Estimate()` function\nNAN_METHOD(CalculateSync) {\n NanScope();\n\n // expect a number as the first argument\n int points = args[0]->Uint32Value();\n double est = Estimate(points);\n\n NanReturnValue(Number::New(est));\n}\n```\n\n```c++\n// async.cc\n#include <node.h>\n#include "nan.h"\n#include "async.h"\n\n// ...\n\nusing namespace v8;\n\nclass PiWorker : public NanAsyncWorker {\n public:\n PiWorker(NanCallback *callback, int points)\n : NanAsyncWorker(callback), points(points) {}\n ~PiWorker() {}\n\n // Executed inside the worker-thread.\n // It is not safe to access V8, or V8 data structures\n // here, so everything we need for input and output\n // should go on `this`.\n void Execute () {\n estimate = Estimate(points);\n }\n\n // Executed when the async work is complete\n // this function will be run inside the main event loop\n // so it is safe to use V8 again\n void HandleOKCallback () {\n NanScope();\n\n Local<Value> argv[] = {\n Local<Value>::New(Null())\n , Number::New(estimate)\n };\n\n callback->Call(2, argv);\n };\n\n private:\n int points;\n double estimate;\n};\n\n// Asynchronous access to the `Estimate()` function\nNAN_METHOD(CalculateAsync) {\n NanScope();\n\n int points = args[0]->Uint32Value();\n NanCallback *callback = new NanCallback(args[1].As<Function>());\n\n NanAsyncQueueWorker(new PiWorker(callback, points));\n NanReturnUndefined();\n}\n```\n\n<a name="api"></a>\n## API\n\n * <a href="#api_nan_method"><b><code>NAN_METHOD</code></b></a>\n * <a href="#api_nan_getter"><b><code>NAN_GETTER</code></b></a>\n * <a href="#api_nan_setter"><b><code>NAN_SETTER</code></b></a>\n * <a href="#api_nan_property_getter"><b><code>NAN_PROPERTY_GETTER</code></b></a>\n * <a href="#api_nan_property_setter"><b><code>NAN_PROPERTY_SETTER</code></b></a>\n * <a href="#api_nan_property_enumerator"><b><code>NAN_PROPERTY_ENUMERATOR</code></b></a>\n * <a href="#api_nan_property_deleter"><b><code>NAN_PROPERTY_DELETER</code></b></a>\n * <a href="#api_nan_property_query"><b><code>NAN_PROPERTY_QUERY</code></b></a>\n * <a href="#api_nan_index_getter"><b><code>NAN_INDEX_GETTER</code></b></a>\n * <a href="#api_nan_index_setter"><b><code>NAN_INDEX_SETTER</code></b></a>\n * <a href="#api_nan_index_enumerator"><b><code>NAN_INDEX_ENUMERATOR</code></b></a>\n * <a href="#api_nan_index_deleter"><b><code>NAN_INDEX_DELETER</code></b></a>\n * <a href="#api_nan_index_query"><b><code>NAN_INDEX_QUERY</code></b></a>\n * <a href="#api_nan_weak_callback"><b><code>NAN_WEAK_CALLBACK</code></b></a>\n * <a href="#api_nan_deprecated"><b><code>NAN_DEPRECATED</code></b></a>\n * <a href="#api_nan_inline"><b><code>NAN_INLINE</code></b></a> \n * <a href="#api_nan_new_local"><b><code>NanNewLocal</code></b></a>\n * <a href="#api_nan_return_value"><b><code>NanReturnValue</code></b></a>\n * <a href="#api_nan_return_undefined"><b><code>NanReturnUndefined</code></b></a>\n * <a href="#api_nan_return_null"><b><code>NanReturnNull</code></b></a>\n * <a href="#api_nan_return_empty_string"><b><code>NanReturnEmptyString</code></b></a>\n * <a href="#api_nan_scope"><b><code>NanScope</code></b></a>\n * <a href="#api_nan_locker"><b><code>NanLocker</code></b></a>\n * <a href="#api_nan_unlocker"><b><code>NanUnlocker</code></b></a>\n * <a href="#api_nan_get_internal_field_pointer"><b><code>NanGetInternalFieldPointer</code></b></a>\n * <a href="#api_nan_set_internal_field_pointer"><b><code>NanSetInternalFieldPointer</code></b></a>\n * <a href="#api_nan_object_wrap_handle"><b><code>NanObjectWrapHandle</code></b></a>\n * <a href="#api_nan_make_weak"><b><code>NanMakeWeak</code></b></a>\n * <a href="#api_nan_symbol"><b><code>NanSymbol</code></b></a>\n * <a href="#api_nan_get_pointer_safe"><b><code>NanGetPointerSafe</code></b></a>\n * <a href="#api_nan_set_pointer_safe"><b><code>NanSetPointerSafe</code></b></a>\n * <a href="#api_nan_raw_string"><b><code>NanRawString</code></b></a>\n * <a href="#api_nan_c_string"><b><code>NanCString</code></b></a>\n * <a href="#api_nan_from_v8_string"><b><code>NanFromV8String</code></b></a>\n * <a href="#api_nan_boolean_option_value"><b><code>NanBooleanOptionValue</code></b></a>\n * <a href="#api_nan_uint32_option_value"><b><code>NanUInt32OptionValue</code></b></a>\n * <a href="#api_nan_error"><b><code>NanError</code></b>, <b><code>NanTypeError</code></b>, <b><code>NanRangeError</code></b></a>\n * <a href="#api_nan_throw_error"><b><code>NanThrowError</code></b>, <b><code>NanThrowTypeError</code></b>, <b><code>NanThrowRangeError</code></b>, <b><code>NanThrowError(Handle<Value>)</code></b>, <b><code>NanThrowError(Handle<Value>, int)</code></b></a>\n * <a href="#api_nan_new_buffer_handle"><b><code>NanNewBufferHandle(char *, size_t, FreeCallback, void *)</code></b>, <b><code>NanNewBufferHandle(char *, uint32_t)</code></b>, <b><code>NanNewBufferHandle(uint32_t)</code></b></a>\n * <a href="#api_nan_buffer_use"><b><code>NanBufferUse(char *, uint32_t)</code></b></a>\n * <a href="#api_nan_new_context_handle"><b><code>NanNewContextHandle</code></b></a>\n * <a href="#api_nan_has_instance"><b><code>NanHasInstance</code></b></a>\n * <a href="#api_nan_persistent_to_local"><b><code>NanPersistentToLocal</code></b></a>\n * <a href="#api_nan_dispose_persistent"><b><code>NanDisposePersistent</code></b></a>\n * <a href="#api_nan_assign_persistent"><b><code>NanAssignPersistent</code></b></a>\n * <a href="#api_nan_init_persistent"><b><code>NanInitPersistent</code></b></a>\n * <a href="#api_nan_callback"><b><code>NanCallback</code></b></a>\n * <a href="#api_nan_async_worker"><b><code>NanAsyncWorker</code></b></a>\n * <a href="#api_nan_async_queue_worker"><b><code>NanAsyncQueueWorker</code></b></a>\n\n<a name="api_nan_method"></a>\n### NAN_METHOD(methodname)\n\nUse `NAN_METHOD` to define your V8 accessible methods:\n\n```c++\n// .h:\nclass Foo : public node::ObjectWrap {\n ...\n\n static NAN_METHOD(Bar);\n static NAN_METHOD(Baz);\n}\n\n\n// .cc:\nNAN_METHOD(Foo::Bar) {\n ...\n}\n\nNAN_METHOD(Foo::Baz) {\n ...\n}\n```\n\nThe reason for this macro is because of the method signature change in 0.11:\n\n```c++\n// 0.10 and below:\nHandle<Value> name(const Arguments& args)\n\n// 0.11 and above\nvoid name(const FunctionCallbackInfo<Value>& args)\n```\n\nThe introduction of `FunctionCallbackInfo` brings additional complications:\n\n<a name="api_nan_getter"></a>\n### NAN_GETTER(methodname)\n\nUse `NAN_GETTER` to declare your V8 accessible getters. You get a `Local<String>` `property` and an appropriately typed `args` object that can act like the `args` argument to a `NAN_METHOD` call.\n\nYou can use `NanReturnNull()`, `NanReturnEmptyString()`, `NanReturnUndefined()` and `NanReturnValue()` in a `NAN_GETTER`.\n\n<a name="api_nan_setter"></a>\n### NAN_SETTER(methodname)\n\nUse `NAN_SETTER` to declare your V8 accessible setters. Same as `NAN_GETTER` but you also get a `Local<Value>` `value` object to work with.\n\n<a name="api_nan_property_getter"></a>\n### NAN_PROPERTY_GETTER(cbname)\nUse `NAN_PROPERTY_GETTER` to declare your V8 accessible property getters. You get a `Local<String>` `property` and an appropriately typed `args` object that can act similar to the `args` argument to a `NAN_METHOD` call.\n\nYou can use `NanReturnNull()`, `NanReturnEmptyString()`, `NanReturnUndefined()` and `NanReturnValue()` in a `NAN_PROPERTY_GETTER`.\n\n<a name="api_nan_property_setter"></a>\n### NAN_PROPERTY_SETTER(cbname)\nUse `NAN_PROPERTY_SETTER` to declare your V8 accessible property setters. Same as `NAN_PROPERTY_GETTER` but you also get a `Local<Value>` `value` object to work with.\n\n<a name="api_nan_property_enumerator"></a>\n### NAN_PROPERTY_ENUMERATOR(cbname)\nUse `NAN_PROPERTY_ENUMERATOR` to declare your V8 accessible property enumerators. You get an appropriately typed `args` object like the `args` argument to a `NAN_PROPERTY_GETTER` call.\n\nYou can use `NanReturnNull()`, `NanReturnEmptyString()`, `NanReturnUndefined()` and `NanReturnValue()` in a `NAN_PROPERTY_ENUMERATOR`.\n\n<a name="api_nan_property_deleter"></a>\n### NAN_PROPERTY_DELETER(cbname)\nUse `NAN_PROPERTY_DELETER` to declare your V8 accessible property deleters. Same as `NAN_PROPERTY_GETTER`.\n\nYou can use `NanReturnNull()`, `NanReturnEmptyString()`, `NanReturnUndefined()` and `NanReturnValue()` in a `NAN_PROPERTY_DELETER`.\n\n<a name="api_nan_property_query"></a>\n### NAN_PROPERTY_QUERY(cbname)\nUse `NAN_PROPERTY_QUERY` to declare your V8 accessible property queries. Same as `NAN_PROPERTY_GETTER`.\n\nYou can use `NanReturnNull()`, `NanReturnEmptyString()`, `NanReturnUndefined()` and `NanReturnValue()` in a `NAN_PROPERTY_QUERY`.\n\n<a name="api_nan_index_getter"></a>\n### NAN_INDEX_GETTER(cbname)\nUse `NAN_INDEX_GETTER` to declare your V8 accessible index getters. You get a `uint32_t` `index` and an appropriately typed `args` object that can act similar to the `args` argument to a `NAN_METHOD` call.\n\nYou can use `NanReturnNull()`, `NanReturnEmptyString()`, `NanReturnUndefined()` and `NanReturnValue()` in a `NAN_INDEX_GETTER`.\n\n<a name="api_nan_index_setter"></a>\n### NAN_INDEX_SETTER(cbname)\nUse `NAN_INDEX_SETTER` to declare your V8 accessible index setters. Same as `NAN_INDEX_GETTER` but you also get a `Local<Value>` `value` object to work with.\n\n<a name="api_nan_index_enumerator"></a>\n### NAN_INDEX_ENUMERATOR(cbname)\nUse `NAN_INDEX_ENUMERATOR` to declare your V8 accessible index enumerators. You get an appropriately typed `args` object like the `args` argument to a `NAN_INDEX_GETTER` call.\n\nYou can use `NanReturnNull()`, `NanReturnEmptyString()`, `NanReturnUndefined()` and `NanReturnValue()` in a `NAN_INDEX_ENUMERATOR`.\n\n<a name="api_nan_index_deleter"></a>\n### NAN_INDEX_DELETER(cbname)\nUse `NAN_INDEX_DELETER` to declare your V8 accessible index deleters. Same as `NAN_INDEX_GETTER`.\n\nYou can use `NanReturnNull()`, `NanReturnEmptyString()`, `NanReturnUndefined()` and `NanReturnValue()` in a `NAN_INDEX_DELETER`.\n\n<a name="api_nan_index_query"></a>\n### NAN_INDEX_QUERY(cbname)\nUse `NAN_INDEX_QUERY` to declare your V8 accessible index queries. Same as `NAN_INDEX_GETTER`.\n\nYou can use `NanReturnNull()`, `NanReturnEmptyString()`, `NanReturnUndefined()` and `NanReturnValue()` in a `NAN_INDEX_QUERY`.\n\n<a name="api_nan_weak_callback"></a>\n### NAN_WEAK_CALLBACK(type, cbname)\n\nUse `NAN_WEAK_CALLBACK` to declare your V8 WeakReference callbacks. There is an object argument accessible through `NAN_WEAK_CALLBACK_OBJECT`. The `type` argument gives the type of the `data` argument, accessible through `NAN_WEAK_CALLBACK_DATA(type)`.\n\n```c++\nstatic NAN_WEAK_CALLBACK(BufferReference*, WeakCheck) {\n if (NAN_WEAK_CALLBACK_DATA(BufferReference*)->noLongerNeeded_) {\n delete NAN_WEAK_CALLBACK_DATA(BufferReference*);\n } else {\n // Still in use, revive, prevent GC\n NanMakeWeak(NAN_WEAK_CALLBACK_OBJECT, NAN_WEAK_CALLBACK_DATA(BufferReference*), &WeakCheck);\n }\n}\n```\n\n<a name="api_nan_deprecated"></a>\n### NAN_DEPRECATED(declarator)\nDeclares a function as deprecated. Identical to `V8_DEPRECATED`.\n\n```c++\nstatic NAN_DEPRECATED(NAN_METHOD(foo)) {\n ...\n}\n```\n\n<a name="api_nan_inline"></a>\n### NAN_INLINE(declarator)\nInlines a function. Identical to `V8_INLINE`.\n\n```c++\nstatic NAN_INLINE(int foo(int bar)) {\n ...\n}\n```\n\n<a name="api_nan_new_local"></a>\n### NanNewLocal&lt;T&gt;(Handle&lt;Value&gt;)\n\nUse `NanNewLocal` in place of `v8::Local<T>::New(...)` as this function\nrequires an `isolate` argument in recent versions of V8 but not in older versions.\n\n```c++\nNanNewLocal<v8::Value>(v8::Null())\n```\n\n<a name="api_nan_return_value"></a>\n### NanReturnValue(Handle&lt;Value&gt;)\n\nUse `NanReturnValue` when you want to return a value from your V8 accessible method:\n\n```c++\nNAN_METHOD(Foo::Bar) {\n ...\n\n NanReturnValue(String::New("FooBar!"));\n}\n```\n\nNo `return` statement required.\n\n<a name="api_nan_return_undefined"></a>\n### NanReturnUndefined()\n\nUse `NanReturnUndefined` when you don\'t want to return anything from your V8 accessible method:\n\n```c++\nNAN_METHOD(Foo::Baz) {\n ...\n\n NanReturnUndefined();\n}\n```\n\n<a name="api_nan_return_null"></a>\n### NanReturnNull()\n\nUse `NanReturnNull` when you want to return `Null` from your V8 accessible method:\n\n```c++\nNAN_METHOD(Foo::Baz) {\n ...\n\n NanReturnNull();\n}\n```\n\n<a name="api_nan_return_empty_string"></a>\n### NanReturnEmptyString()\n\nUse `NanReturnEmptyString` when you want to return an empty `String` from your V8 accessible method:\n\n```c++\nNAN_METHOD(Foo::Baz) {\n ...\n\n NanReturnEmptyString();\n}\n```\n\n<a name="api_nan_scope"></a>\n### NanScope()\n\nThe introduction of `isolate` references for many V8 calls in Node 0.11 makes `NanScope()` necessary, use it in place of `HandleScope scope`:\n\n```c++\nNAN_METHOD(Foo::Bar) {\n NanScope();\n\n NanReturnValue(String::New("FooBar!"));\n}\n```\n\n<a name="api_nan_locker"></a>\n### NanLocker()\n\nThe introduction of `isolate` references for many V8 calls in Node 0.11 makes `NanLocker()` necessary, use it in place of `Locker locker`:\n\n```c++\nNAN_METHOD(Foo::Bar) {\n NanLocker();\n ...\n NanUnlocker();\n}\n```\n\n<a name="api_nan_unlocker"></a>\n### NanUnlocker()\n\nThe introduction of `isolate` references for many V8 calls in Node 0.11 makes `NanUnlocker()` necessary, use it in place of `Unlocker unlocker`:\n\n```c++\nNAN_METHOD(Foo::Bar) {\n NanLocker();\n ...\n NanUnlocker();\n}\n```\n\n<a name="api_nan_get_internal_field_pointer"></a>\n### void * NanGetInternalFieldPointer(Handle&lt;Object&gt;, int)\n\nGets a pointer to the internal field with at `index` from a V8 `Object` handle.\n\n```c++\nLocal<Object> obj;\n...\nNanGetInternalFieldPointer(obj, 0);\n```\n<a name="api_nan_set_internal_field_pointer"></a>\n### void NanSetInternalFieldPointer(Handle&lt;Object&gt;, int, void *)\n\nSets the value of the internal field at `index` on a V8 `Object` handle.\n\n```c++\nstatic Persistent<Function> dataWrapperCtor;\n...\nLocal<Object> wrapper = NanPersistentToLocal(dataWrapperCtor)->NewInstance();\nNanSetInternalFieldPointer(wrapper, 0, this);\n```\n\n<a name="api_nan_object_wrap_handle"></a>\n### Local&lt;Object&gt; NanObjectWrapHandle(Object)\n\nWhen you want to fetch the V8 object handle from a native object you\'ve wrapped with Node\'s `ObjectWrap`, you should use `NanObjectWrapHandle`:\n\n```c++\nNanObjectWrapHandle(iterator)->Get(String::NewSymbol("end"))\n```\n\n<a name="api_nan_make_weak"></a>\n### NanMakeWeak(Persistent&lt;T&gt;, parameter, callback)\n\nMake a persistent reference weak.\n\n<a name="api_nan_symbol"></a>\n### String NanSymbol(char *)\n\nThis isn\'t strictly about compatibility, it\'s just an easier way to create string symbol objects (i.e. `String::NewSymbol(x)`), for getting and setting object properties, or names of objects.\n\n```c++\nbool foo = false;\nif (obj->Has(NanSymbol("foo")))\n foo = optionsObj->Get(NanSymbol("foo"))->BooleanValue()\n```\n\n<a name="api_nan_get_pointer_safe"></a>\n### Type NanGetPointerSafe(Type *[, Type])\n\nA helper for getting values from optional pointers. If the pointer is `NULL`, the function returns the optional default value, which defaults to `0`. Otherwise, the function returns the value the pointer points to.\n\n```c++\nchar *plugh(uint32_t *optional) {\n char res[] = "xyzzy";\n uint32_t param = NanGetPointerSafe<uint32_t>(optional, 0x1337);\n switch (param) {\n ...\n }\n NanSetPointerSafe<uint32_t>(optional, 0xDEADBEEF);\n} \n```\n\n<a name="api_nan_set_pointer_safe"></a>\n### bool NanSetPointerSafe(Type *, Type)\n\nA helper for setting optional argument pointers. If the pointer is `NULL`, the function simply return `false`. Otherwise, the value is assigned to the variable the pointer points to.\n\n```c++\nconst char *plugh(size_t *outputsize) {\n char res[] = "xyzzy";\n if !(NanSetPointerSafe<size_t>(outputsize, strlen(res) + 1)) {\n ...\n }\n\n ...\n}\n```\n\n<a name="api_nan_raw_string"></a>\n### void* NanRawString(Handle&lt;Value&gt;, enum Nan::Encoding, size_t *, void *, size_t, int)\n\nWhen you want to convert a V8 `String` to a `char*` buffer, use `NanRawString`. You have to supply an encoding as well as a pointer to a variable that will be assigned the number of bytes in the returned string. It is also possible to supply a buffer and its length to the function in order not to have a new buffer allocated. The final argument allows setting `String::WriteOptions`.\nJust remember that you\'ll end up with an object that you\'ll need to `delete[]` at some point unless you supply your own buffer:\n\n```c++\nsize_t count;\nvoid* decoded = NanRawString(args[1], Nan::BASE64, &count, NULL, 0, String::HINT_MANY_WRITES_EXPECTED);\nchar param_copy[count];\nmemcpy(param_copy, decoded, count);\ndelete[] decoded;\n```\n\n<a name="api_nan_c_string"></a>\n### char* NanCString(Handle&lt;Value&gt;, size_t *[, char *, size_t, int])\n\nWhen you want to convert a V8 `String` to a null-terminated C `char*` use `NanCString`. The resulting `char*` will be UTF-8-encoded, and you need to supply a pointer to a variable that will be assigned the number of bytes in the returned string. It is also possible to supply a buffer and its length to the function in order not to have a new buffer allocated. The final argument allows optionally setting `String::WriteOptions`, which default to `v8::String::NO_OPTIONS`.\nJust remember that you\'ll end up with an object that you\'ll need to `delete[]` at some point unless you supply your own buffer:\n\n```c++\nsize_t count;\nchar* name = NanCString(args[0], &count);\n```\n\n<a name="api_nan_from_v8_string"></a>\n### char* NanFromV8String(Handle&lt;Value&gt;[, enum Nan::Encoding, size_t *, char *, size_t, int])\n\nA convenience function that uses `NanRawString()` to convert a V8 `String` to a `char*`. Defaults to UTF8 encoding and no null-termination.\n\n```c++\nsize_t count;\nchar* name = NanFromV8String(args[0]);\n```\n\n<a name="api_nan_boolean_option_value"></a>\n### bool NanBooleanOptionValue(Handle&lt;Value&gt;, Handle&lt;String&gt;[, bool])\n\nWhen you have an "options" object that you need to fetch properties from, boolean options can be fetched with this pair. They check first if the object exists (`IsEmpty`), then if the object has the given property (`Has`) then they get and convert/coerce the property to a `bool`.\n\nThe optional last parameter is the *default* value, which is `false` if left off:\n\n```c++\n// `foo` is false unless the user supplies a truthy value for it\nbool foo = NanBooleanOptionValue(optionsObj, NanSymbol("foo"));\n// `bar` is true unless the user supplies a falsy value for it\nbool bar = NanBooleanOptionValueDefTrue(optionsObj, NanSymbol("bar"), true);\n```\n\n<a name="api_nan_uint32_option_value"></a>\n### uint32_t NanUInt32OptionValue(Handle&lt;Value&gt;, Handle&lt;String&gt;, uint32_t)\n\nSimilar to `NanBooleanOptionValue`, use `NanUInt32OptionValue` to fetch an integer option from your options object. Can be any kind of JavaScript `Number` and it will be coerced to an unsigned 32-bit integer.\n\nRequires all 3 arguments as a default is not optional:\n\n```c++\nuint32_t count = NanUInt32OptionValue(optionsObj, NanSymbol("count"), 1024);\n```\n\n<a name="api_nan_error"></a>\n### NanError(message), NanTypeError(message), NanRangeError(message)\n\nFor making `Error`, `TypeError` and `RangeError` objects.\n\n```c++\nLocal<Value> res = NanError("you must supply a callback argument");\n```\n\n<a name="api_nan_throw_error"></a>\n### NanThrowError(message), NanThrowTypeError(message), NanThrowRangeError(message), NanThrowError(Local&lt;Value&gt;), NanThrowError(Local&lt;Value&gt;, int)\n\nFor throwing `Error`, `TypeError` and `RangeError` objects. You should `return` this call:\n\n```c++\nreturn NanThrowError("you must supply a callback argument");\n```\n\nCan also handle any custom object you may want to throw. If used with the error code argument, it will add the supplied error code to the error object as a property called `code`.\n\n<a name="api_nan_new_buffer_handle"></a>\n### Local&lt;Object&gt; NanNewBufferHandle(char *, uint32_t), Local&lt;Object&gt; NanNewBufferHandle(uint32_t)\n\nThe `Buffer` API has changed a little in Node 0.11, this helper provides consistent access to `Buffer` creation:\n\n```c++\nNanNewBufferHandle((char*)value.data(), value.size());\n```\n\nCan also be used to initialize a `Buffer` with just a `size` argument.\n\nCan also be supplied with a `NAN_WEAK_CALLBACK` and a hint for the garbage collector, when dealing with weak references.\n\n<a name="api_nan_buffer_use"></a>\n### Local&lt;Object&gt; NanBufferUse(char*, uint32_t)\n\n`Buffer::New(char*, uint32_t)` prior to 0.11 would make a copy of the data.\nWhile it was possible to get around this, it required a shim by passing a\ncallback. So the new API `Buffer::Use(char*, uint32_t)` was introduced to remove\nneeding to use this shim.\n\n`NanBufferUse` uses the `char*` passed as the backing data, and will free the\nmemory automatically when the weak callback is called. Keep this in mind, as\ncareless use can lead to "double free or corruption" and other cryptic failures.\n\n<a name="api_nan_has_instance"></a>\n### bool NanHasInstance(Persistent&lt;FunctionTemplate&gt;&, Handle&lt;Value&gt;)\n\nCan be used to check the type of an object to determine it is of a particular class you have already defined and have a `Persistent<FunctionTemplate>` handle for.\n\n<a name="api_nan_persistent_to_local"></a>\n### Local&lt;Type&gt; NanPersistentToLocal(Persistent&lt;Type&gt;&)\n\nAside from `FunctionCallbackInfo`, the biggest and most painful change to V8 in Node 0.11 is the many restrictions now placed on `Persistent` handles. They are difficult to assign and difficult to fetch the original value out of.\n\nUse `NanPersistentToLocal` to convert a `Persistent` handle back to a `Local` handle.\n\n```c++\nLocal<Object> handle = NanPersistentToLocal(persistentHandle);\n```\n\n<a href="#api_nan_new_context_handle">\n### Local&lt;Context&gt; NanNewContextHandle([ExtensionConfiguration*, Handle&lt;ObjectTemplate&gt;, Handle&lt;Value&gt;])\nCreates a new `Local<Context>` handle.\n\n```c++\nLocal<FunctionTemplate> ftmpl = FunctionTemplate::New();\nLocal<ObjectTemplate> otmpl = ftmpl->InstanceTemplate();\nLocal<Context> ctx = NanNewContextHandle(NULL, otmpl);\n```\n\n<a name="api_nan_dispose_persistent"></a>\n### void NanDisposePersistent(Persistent&lt;T&gt; &)\n\nUse `NanDisposePersistent` to dispose a `Persistent` handle.\n\n```c++\nNanDisposePersistent(persistentHandle);\n```\n\n<a name="api_nan_assign_persistent"></a>\n### NanAssignPersistent(type, handle, object)\n\nUse `NanAssignPersistent` to assign a non-`Persistent` handle to a `Persistent` one. You can no longer just declare a `Persistent` handle and assign directly to it later, you have to `Reset` it in Node 0.11, so this makes it easier.\n\nIn general it is now better to place anything you want to protect from V8\'s garbage collector as properties of a generic `Object` and then assign that to a `Persistent`. This works in older versions of Node also if you use `NanAssignPersistent`:\n\n```c++\nPersistent<Object> persistentHandle;\n\n...\n\nLocal<Object> obj = Object::New();\nobj->Set(NanSymbol("key"), keyHandle); // where keyHandle might be a Local<String>\nNanAssignPersistent(Object, persistentHandle, obj)\n```\n\n<a name="api_nan_init_persistent"></a>\n### NanInitPersistent(type, name, object)\n\nUser `NanInitPersistent` to declare and initialize a new `Persistent` with the supplied object. The assignment operator for `Persistent` is no longer public in Node 0.11, so this macro makes it easier to declare and initializing a new `Persistent`. See <a href="#api_nan_assign_persistent"><b><code>NanAssignPersistent</code></b></a> for more information.\n\n```c++\nLocal<Object> obj = Object::New();\nobj->Set(NanSymbol("key"), keyHandle); // where keyHandle might be a Local<String>\nNanInitPersistent(Object, persistentHandle, obj);\n```\n\n<a name="api_nan_callback"></a>\n### NanCallback\n\nBecause of the difficulties imposed by the changes to `Persistent` handles in V8 in Node 0.11, creating `Persistent` versions of your `Handle<Function>` is annoyingly tricky. `NanCallback` makes it easier by taking your handle, making it persistent until the `NanCallback` is deleted and even providing a handy `Call()` method to fetch and execute the callback `Function`.\n\n```c++\nLocal<Function> callbackHandle = args[0].As<Function>();\nNanCallback *callback = new NanCallback(callbackHandle);\n// pass `callback` around and it\'s safe from GC until you:\ndelete callback;\n```\n\nYou can execute the callback like so:\n\n```c++\n// no arguments:\ncallback->Call(0, NULL);\n\n// an error argument:\nHandle<Value> argv[] = {\n Exception::Error(String::New("fail!"))\n};\ncallback->Call(1, argv);\n\n// a success argument:\nHandle<Value> argv[] = {\n Null(),\n String::New("w00t!")\n};\ncallback->Call(2, argv);\n```\n\n`NanCallback` also has a `Local<Function> GetCallback()` method that you can use\nto fetch a local handle to the underlying callback function, as well as a\n`void SetFunction(Handle<Function>)` for setting the callback on the\n`NanCallback`. Additionally a generic constructor is available for using\n`NanCallback` without performing heap allocations.\n\n<a name="api_nan_async_worker"></a>\n### NanAsyncWorker\n\n`NanAsyncWorker` is an abstract class that you can subclass to have much of the annoying async queuing and handling taken care of for you. It can even store arbitrary V8 objects for you and have them persist while the async work is in progress.\n\nSee a rough outline of the implementation:\n\n```c++\nclass NanAsyncWorker {\npublic:\n NanAsyncWorker (NanCallback *callback);\n\n // Clean up persistent handles and delete the *callback\n virtual ~NanAsyncWorker ();\n\n // Check the `char *errmsg` property and call HandleOKCallback()\n // or HandleErrorCallback depending on whether it has been set or not\n virtual void WorkComplete ();\n\n // You must implement this to do some async work. If there is an\n // error then allocate `errmsg` to to a message and the callback will\n // be passed that string in an Error object\n virtual void Execute ();\n\n // Save a V8 object in a Persistent handle to protect it from GC\n void SavePersistent(const char *key, Local<Object> &obj);\n\n // Fetch a stored V8 object (don\'t call from within `Execute()`)\n Local<Object> GetFromPersistent(const char *key);\n\nprotected:\n // Set this if there is an error, otherwise it\'s NULL\n const char *errmsg;\n\n // Default implementation calls the callback function with no arguments.\n // Override this to return meaningful data\n virtual void HandleOKCallback ();\n\n // Default implementation calls the callback function with an Error object\n // wrapping the `errmsg` string\n virtual void HandleErrorCallback ();\n};\n```\n\n<a name="api_nan_async_queue_worker"></a>\n### NanAsyncQueueWorker(NanAsyncWorker *)\n\n`NanAsyncQueueWorker` will run a `NanAsyncWorker` asynchronously via libuv. Both the *execute* and *after_work* steps are taken care of for you&mdash;most of the logic for this is embedded in `NanAsyncWorker`.\n\n### Contributors\n\nNAN is only possible due to the excellent work of the following contributors:\n\n<table><tbody>\n<tr><th align="left">Rod Vagg</th><td><a href="https://github.com/rvagg">GitHub/rvagg</a></td><td><a href="http://twitter.com/rvagg">Twitter/@rvagg</a></td></tr>\n<tr><th align="left">Benjamin Byholm</th><td><a href="https://github.com/kkoopa/">GitHub/kkoopa</a></td></tr>\n<tr><th align="left">Trevor Norris</th><td><a href="https://github.com/trevnorris">GitHub/trevnorris</a></td><td><a href="http://twitter.com/trevnorris">Twitter/@trevnorris</a></td></tr>\n<tr><th align="left">Nathan Rajlich</th><td><a href="https://github.com/TooTallNate">GitHub/TooTallNate</a></td><td><a href="http://twitter.com/TooTallNate">Twitter/@TooTallNate</a></td></tr>\n<tr><th align="left">Brett Lawson</th><td><a href="https://github.com/brett19">GitHub/brett19</a></td><td><a href="http://twitter.com/brett19x">Twitter/@brett19x</a></td></tr>\n<tr><th align="left">Ben Noordhuis</th><td><a href="https://github.com/bnoordhuis">GitHub/bnoordhuis</a></td><td><a href="http://twitter.com/bnoordhuis">Twitter/@bnoordhuis</a></td></tr>\n</tbody></table>\n\nLicence &amp; copyright\n-----------------------\n\nCopyright (c) 2013 NAN contributors (listed above).\n\nNative Abstractions for Node.js is licensed under an MIT +no-false-attribs license. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details.\n',
154 silly resolved readmeFilename: 'README.md',
154 silly resolved bugs: { url: 'https://github.com/rvagg/nan/issues' },
154 silly resolved homepage: 'https://github.com/rvagg/nan',
154 silly resolved _id: 'nan@0.8.0',
154 silly resolved _from: 'nan@~0.8.0' } ]
155 info install nan@0.8.0 into <path>/<project>/node_modules/fsevents
156 info installOne nan@0.8.0
157 info <path>/<project>/node_modules/fsevents/node_modules/nan unbuild
158 verbose tar unpack <home>/.npm/nan/0.8.0/package.tgz
159 silly lockFile 2c19eda4-... tar://<path>/<project>/node_modules/fsevents/node_modules/nan
160 verbose lock tar://<path>/<project>/node_modules/fsevents/node_modules/nan <home>/.npm/2c19eda4-....lock
161 silly lockFile 9a47f2ad-... tar://<home>/.npm/nan/0.8.0/package.tgz
162 verbose lock tar://<home>/.npm/nan/0.8.0/package.tgz <home>/.npm/9a47f2ad-....lock
163 silly gunzTarPerm modes [ '755', '644' ]
164 silly gunzTarPerm extractEntry package.json
165 silly gunzTarPerm extractEntry README.md
166 silly gunzTarPerm extractEntry LICENSE
167 silly gunzTarPerm extractEntry include_dirs.js
168 silly gunzTarPerm extractEntry .dntrc
169 silly gunzTarPerm extractEntry build/config.gypi
170 silly gunzTarPerm extractEntry nan.h
171 silly lockFile 2c19eda4-... tar://<path>/<project>/node_modules/fsevents/node_modules/nan
172 silly lockFile 2c19eda4-... tar://<path>/<project>/node_modules/fsevents/node_modules/nan
173 silly lockFile 9a47f2ad-... tar://<home>/.npm/nan/0.8.0/package.tgz
174 silly lockFile 9a47f2ad-... tar://<home>/.npm/nan/0.8.0/package.tgz
175 info preinstall nan@0.8.0
176 verbose readDependencies using package.json deps
177 verbose readDependencies using package.json deps
178 silly resolved []
179 verbose about to build <path>/<project>/node_modules/fsevents/node_modules/nan
180 info build <path>/<project>/node_modules/fsevents/node_modules/nan
181 verbose linkStuff [ false,
181 verbose linkStuff false,
181 verbose linkStuff false,
181 verbose linkStuff '<path>/<project>/node_modules/fsevents/node_modules' ]
182 info linkStuff nan@0.8.0
183 verbose linkBins nan@0.8.0
184 verbose linkMans nan@0.8.0
185 verbose rebuildBundles nan@0.8.0
186 info install nan@0.8.0
187 info postinstall nan@0.8.0
188 verbose about to build <path>/<project>/node_modules/fsevents
189 info build <path>/<project>/node_modules/fsevents
190 verbose linkStuff [ false,
190 verbose linkStuff false,
190 verbose linkStuff false,
190 verbose linkStuff '<path>/<project>/node_modules' ]
191 info linkStuff fsevents@0.2.0
192 verbose linkBins fsevents@0.2.0
193 verbose linkMans fsevents@0.2.0
194 verbose rebuildBundles fsevents@0.2.0
195 verbose rebuildBundles [ 'nan' ]
196 info install fsevents@0.2.0
197 verbose unsafe-perm in lifecycle true
198 info fsevents@0.2.0 Failed to exec install script
199 info <path>/<project>/node_modules/fsevents unbuild
200 info preuninstall fsevents@0.2.0
201 info uninstall fsevents@0.2.0
202 verbose true,<path>/<project>/node_modules,<path>/<project>/node_modules unbuild fsevents@0.2.0
203 info postuninstall fsevents@0.2.0
204 error fsevents@0.2.0 install: `node-gyp rebuild`
204 error Exit status 1
205 error Failed at the fsevents@0.2.0 install script.
205 error This is most likely a problem with the fsevents package,
205 error not with npm itself.
205 error Tell the author that this fails on your system:
205 error node-gyp rebuild
205 error You can get their info via:
205 error npm owner ls fsevents
205 error There is likely additional logging output above.
206 error System Darwin 10.8.0
207 error command "/usr/local/Cellar/node/0.10.25/bin/node" "/usr/local/bin/npm" "install" "<path>/fsevents/"
208 error cwd <path>/<project>
209 error node -v v0.10.25
210 error npm -v 1.3.24
211 error code ELIFECYCLE
212 verbose exit [ 1, true ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment