From e0ac8d15af46aadd1c220599e63199b154a514e6 Mon Sep 17 00:00:00 2001 From: TooTallNate Date: Tue, 4 Dec 2012 15:15:44 -0800 Subject: [PATCH] doc(wiki): Created Updating npm's bundled node gyp (markdown) --- Updating-npm's-bundled-node-gyp.md | 38 ++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 Updating-npm's-bundled-node-gyp.md diff --git a/Updating-npm's-bundled-node-gyp.md b/Updating-npm's-bundled-node-gyp.md new file mode 100644 index 0000000000..e9f9d00744 --- /dev/null +++ b/Updating-npm's-bundled-node-gyp.md @@ -0,0 +1,38 @@ +`npm` bundles its own, internal, copy of `node-gyp`. This internal copy is independent of any globally installed copy of node-gyp that you may have installed via `npm install -g node-gyp`. + +This means that while `node-gyp` doesn't get installed into your `$PATH` by default, npm still keeps its own copy to invoke when you attempt to `npm install` a native addon. + +Sometimes, you may need to update npm's internal node-gyp to a newer version than what is installed. A simple `npm install -g node-gyp` _won't_ do the trick since npm will still continue to use its internal copy over the global one. + +So instead: + +### Linux, Mac OS X, Solaris, etc. + +Unix is easy. Just run the following command. Use `sudo` if necessary. + +``` bash +$ [sudo] npm explore npm -g -- npm install node-gyp +``` + +### Windows + +Windows is a bit tricker, since `npm` gets installed to the "Program Files" directory, which needs admin privileges in order to modify on current Windows. Therefore, run the following commands __inside a `cmd.exe` started with "Run as Administrator"__: + +First we need to find the location of `node`. If you don't already know the location that `node.exe` got installed to, then run: + +``` bash +$ npm install -g which +$ which node +``` + +Now `cd` to the directory that `node.exe` is contained in, and with `node_modules\npm` at the end. i.e.: + +``` bash +$ cd "C:\Program Files\nodejs\node_modules\npm" +``` + +Now you can finally run: + +``` bash +npm install node-gyp +``` \ No newline at end of file