Error: "pre" versions of node cannot be installed, use the --nodedir flag instead
```
This error is caused when you attempt to compile a native addon using a version of node.js with `-pre` at the end of the version number:
``` bash
$ node -v
v0.10.4-pre
```
## How to avoid (the short answer)
To avoid this error completely just use a stable release of node.js. i.e. `v0.10.4`, and __not__`v0.10.4-pre`.
## How to fix (the long answer)
This error happens because `node-gyp` does not know what header files were used to compile your "pre" version of node, and therefore it needs you to specify the node source code directory path using the `--nodedir` flag.
For example, if I compiled my development ("pre") version of node.js using the source code in `/Users/nrajlich/node`, then I could invoke `node-gyp` like:
__Note:__ This is for advanced users who use `-pre` versions of node more often than tagged releases.
If you're invoking `node-gyp` through `npm`, then you can leverage `npm`'s configuration system and not have to specify the `--nodedir` flag all the time: