See this comment: #2354 (comment)
To restate the main changes needed:
- The Windows instructions are incorrect, as they use the
-g flag (meaning, to modify a standalone, global install of node-gyp), whereas the instructions are supposed to be telling you how to cd into the npm folder and locally update the copy/copies of node-gyp installed there. The use of the -g flag is inappropriate and leads to npm retaining its old/outdated copy of node-gyp.
- Also, it seems to be necessary (in my testing) to upgrade
node-gyp in two places, as multiple packages directly depend on node-gyp; not only npm itself, but the subdependency npm-lifecycle. One must cd into each package and upgrade its node-gyp dependency manually.