From dce47c960d26525de40617c20bf0ef0392eec573 Mon Sep 17 00:00:00 2001 From: owl-from-hogvarts Date: Fri, 17 Dec 2021 15:45:26 +0300 Subject: [PATCH 1/4] docs: rephrase explanation of which node-gyp is used by npm --- docs/Force-npm-to-use-global-node-gyp.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/Force-npm-to-use-global-node-gyp.md b/docs/Force-npm-to-use-global-node-gyp.md index d12d1526b8..e6a321c794 100644 --- a/docs/Force-npm-to-use-global-node-gyp.md +++ b/docs/Force-npm-to-use-global-node-gyp.md @@ -5,14 +5,14 @@ [Many issues](https://github.com/nodejs/node-gyp/labels/ERR%21%20node-gyp%20-v%20%3C%3D%20v5.1.0) are opened by users who are not running a [current version of node-gyp](https://github.com/nodejs/node-gyp/releases). -`npm` bundles its own, internal, copy of `node-gyp`. This internal copy is independent of any globally installed copy of node-gyp that +`npm` bundles its own, internal, copy of `node-gyp` located at `npm/node_modules` (referred as npm's own ones). So npm's own node modules are separated from *global* ones. Therefor this internal copy of `node-gyp` is independent from any globally installed copy of `node-gyp` that may have been installed via `npm install -g node-gyp`. -Generally, npm's library files are installed inside your global "node_modules", where npm is installed (run `npm prefix` and add `lib/node_modules`, or just `node_modules` for Windows). There are some exceptions to this. Inside this global `node_modules/` there will be an `npm/` directory and inside this you'll find a `node_modules/node-gyp/` directory. So it may look something like `/usr/local/lib/node_modules/npm/node_modules/node-gyp/`. This is the version of node-gyp that ships with npm. +So npm's internal copy of node-gyp **isn't** stored inside *global* `node_modules` and thus isn't available for use as a standalone package. Npm uses it's *internal* copy of `node-gyp` to automatically build native addons. -When you install a _new_ version of node-gyp outside of npm, it'll go into your global node_modules, but not under the `npm/node_modules`. So that may look like `/usr/local/lib/node_modules/node-gyp/`. It'll have the `node-gyp` executable linked into your `PATH` so running `node-gyp` will use this version. +When you install a _new_ version of node-gyp outside of npm, it'll go into your *global* `node_modules`, but not under the `npm/node_modules` (where internal copy of node-gyp is stored). So it will get into your `$PATH` and you will be able to use this globally installed version (**but not internal node-gyp of npm**) as any other globally installed package. -The catch is that npm won't use this version unless you tell it to, it'll keep on using the one you have installed. You need to instruct it to by setting the `node_gyp` config variable (which goes into your `~/.npmrc`). You do this by running the `npm config set` command as below. Then npm will use the command in the path you supply whenever it needs to build a native addon. +The catch is that `npm` **won't** use global version unless you tell it to, it'll keep on using the **internal one**. You need to instruct it to by setting the `node_gyp` config variable (which goes into your `~/.npmrc`). You do this by running the `npm config set` command as below. Then npm will use the command in the path you supply whenever it needs to build a native addon. **Important**: You also need to remember to unset this when you upgrade npm with a newer version of node-gyp, or you have to manually keep your globally installed node-gyp to date. See "Undo" below. From 0f4364af31cf0d6bd22d539549bbe11b016b4f4a Mon Sep 17 00:00:00 2001 From: owl from hogvarts <47751812+owl-from-hogvarts@users.noreply.github.com> Date: Fri, 7 Jan 2022 11:35:26 +0300 Subject: [PATCH 2/4] fix: case of npm word Co-authored-by: Rod Vagg --- docs/Force-npm-to-use-global-node-gyp.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Force-npm-to-use-global-node-gyp.md b/docs/Force-npm-to-use-global-node-gyp.md index e6a321c794..2c91275cd0 100644 --- a/docs/Force-npm-to-use-global-node-gyp.md +++ b/docs/Force-npm-to-use-global-node-gyp.md @@ -8,7 +8,7 @@ not running a [current version of node-gyp](https://github.com/nodejs/node-gyp/r `npm` bundles its own, internal, copy of `node-gyp` located at `npm/node_modules` (referred as npm's own ones). So npm's own node modules are separated from *global* ones. Therefor this internal copy of `node-gyp` is independent from any globally installed copy of `node-gyp` that may have been installed via `npm install -g node-gyp`. -So npm's internal copy of node-gyp **isn't** stored inside *global* `node_modules` and thus isn't available for use as a standalone package. Npm uses it's *internal* copy of `node-gyp` to automatically build native addons. +So npm's internal copy of node-gyp **isn't** stored inside *global* `node_modules` and thus isn't available for use as a standalone package. npm uses it's *internal* copy of `node-gyp` to automatically build native addons. When you install a _new_ version of node-gyp outside of npm, it'll go into your *global* `node_modules`, but not under the `npm/node_modules` (where internal copy of node-gyp is stored). So it will get into your `$PATH` and you will be able to use this globally installed version (**but not internal node-gyp of npm**) as any other globally installed package. From 64d44282aff5e61b31bc4ffc0ffc90a17496cfd2 Mon Sep 17 00:00:00 2001 From: owl from hogvarts <47751812+owl-from-hogvarts@users.noreply.github.com> Date: Fri, 7 Jan 2022 11:41:07 +0300 Subject: [PATCH 3/4] fix: reverb statement (npm/global node_modules) Co-authored-by: Rod Vagg --- docs/Force-npm-to-use-global-node-gyp.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Force-npm-to-use-global-node-gyp.md b/docs/Force-npm-to-use-global-node-gyp.md index 2c91275cd0..d482101ff5 100644 --- a/docs/Force-npm-to-use-global-node-gyp.md +++ b/docs/Force-npm-to-use-global-node-gyp.md @@ -5,7 +5,7 @@ [Many issues](https://github.com/nodejs/node-gyp/labels/ERR%21%20node-gyp%20-v%20%3C%3D%20v5.1.0) are opened by users who are not running a [current version of node-gyp](https://github.com/nodejs/node-gyp/releases). -`npm` bundles its own, internal, copy of `node-gyp` located at `npm/node_modules` (referred as npm's own ones). So npm's own node modules are separated from *global* ones. Therefor this internal copy of `node-gyp` is independent from any globally installed copy of `node-gyp` that +npm bundles its own, internal, copy of node-gyp located at `npm/node_modules`, within npm's private dependencies which are separate from *globally* accessible packages. Therefore this internal copy of node-gyp is independent from any globally installed copy of node-gyp that may have been installed via `npm install -g node-gyp`. So npm's internal copy of node-gyp **isn't** stored inside *global* `node_modules` and thus isn't available for use as a standalone package. npm uses it's *internal* copy of `node-gyp` to automatically build native addons. From eb468beba654d25edbdcc7d5983c51722eb55bf7 Mon Sep 17 00:00:00 2001 From: owl from hogvarts <47751812+owl-from-hogvarts@users.noreply.github.com> Date: Fri, 7 Jan 2022 11:41:42 +0300 Subject: [PATCH 4/4] fix: remove npm word highlight Co-authored-by: Rod Vagg --- docs/Force-npm-to-use-global-node-gyp.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Force-npm-to-use-global-node-gyp.md b/docs/Force-npm-to-use-global-node-gyp.md index d482101ff5..c6304e490a 100644 --- a/docs/Force-npm-to-use-global-node-gyp.md +++ b/docs/Force-npm-to-use-global-node-gyp.md @@ -12,7 +12,7 @@ So npm's internal copy of node-gyp **isn't** stored inside *global* `node_module When you install a _new_ version of node-gyp outside of npm, it'll go into your *global* `node_modules`, but not under the `npm/node_modules` (where internal copy of node-gyp is stored). So it will get into your `$PATH` and you will be able to use this globally installed version (**but not internal node-gyp of npm**) as any other globally installed package. -The catch is that `npm` **won't** use global version unless you tell it to, it'll keep on using the **internal one**. You need to instruct it to by setting the `node_gyp` config variable (which goes into your `~/.npmrc`). You do this by running the `npm config set` command as below. Then npm will use the command in the path you supply whenever it needs to build a native addon. +The catch is that npm **won't** use global version unless you tell it to, it'll keep on using the **internal one**. You need to instruct it to by setting the `node_gyp` config variable (which goes into your `~/.npmrc`). You do this by running the `npm config set` command as below. Then npm will use the command in the path you supply whenever it needs to build a native addon. **Important**: You also need to remember to unset this when you upgrade npm with a newer version of node-gyp, or you have to manually keep your globally installed node-gyp to date. See "Undo" below.