Skip to content

Commit 1dcad87

Browse files
cclaussrvagg
authored andcommitted
doc(wiki): Make changes discussed in #2416
1 parent 7444b47 commit 1dcad87

File tree

1 file changed

+24
-17
lines changed

1 file changed

+24
-17
lines changed

Updating-npm's-bundled-node-gyp.md

+24-17
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,53 @@
1-
`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`.
1+
`npm` bundles its own, internal, copy of `node-gyp`. This internal copy is independent of any globally installed copy of node-gyp that
2+
you may have installed via `npm install -g node-gyp`.
23

3-
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.
4+
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
5+
attempt to `npm install` a native add-on.
46

5-
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.
7+
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`
8+
_won't_ do the trick since npm will still continue to use its internal copy over the global one.
69

710
So instead:
811

912
## Linux, Mac OS X, Solaris, etc.
1013

1114
Unix is easy. Just run the following command. Use `sudo` if necessary.
12-
13-
``` bash
14-
$ [sudo] npm explore npm -g -- npm install node-gyp@latest
15+
```bash
16+
$ [sudo] npm explore npm/node_modules/npm-lifecycle -g -- npm install node-gyp@latest
1517
```
1618

1719
## Windows
1820

19-
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"__:
21+
Windows is a bit trickier, since `npm` might be installed to the "Program Files" directory, which needs admin privileges in order to
22+
modify on current Windows. Therefore, run the following commands __inside a `cmd.exe` started with "Run as Administrator"__:
2023

2124
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:
22-
23-
``` bash
25+
```bash
2426
$ npm install -g which
2527
$ which node
2628
```
2729

2830
As an alternative to the above, those on Windows Server 2003 and later (this includes Windows 7) can run:
29-
30-
``` bash
31+
```bash
3132
$ where node
3233
```
3334

3435
Now `cd` to the directory that `node.exe` is contained in, and with `node_modules\npm` at the end. i.e.:
35-
36-
``` bash
36+
```bash
3737
$ cd "C:\Program Files\nodejs\node_modules\npm"
3838
```
3939

40-
Now you can finally run:
40+
Now you can run:
41+
```bash
42+
$ npm install node-gyp@latest
43+
```
4144

42-
``` bash
43-
$ npm install -g node-gyp@latest
45+
Now `cd` to the `npm-lifecycle` directory:
46+
```bash
47+
$ cd node_modules\npm-lifecycle
4448
```
4549

46-
note: i found that the -g on windows 7 is not correct. It gets installed in C:\Users\<name>\AppData\Roaming\npm\node_modules\gyp which is not the directory where node is installed C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\...
50+
Now you can finally run (again):
51+
```bash
52+
$ npm install node-gyp@latest
53+
```

0 commit comments

Comments
 (0)