Subject: [bug#51838] [PATCH v3 04/43] gnu: node: Add an npmrc file to set nodedir.

From: Philip McGrath <[email-masked]>
Date: Sun, 12 Dec 2021 15:19:03 -0500

Hi!

On 12/12/21 10:19, Pierre Langlois wrote:
> When I run `node-gyp configure' in my tree-sitter packages, it's not
> able to find the node dir and tries to download headers. So I need to
> set `npm_config_nodedir' manually, like so:

> I'm wondering if the npmrc approach here is working properly? I see in
> another patch you've used the `npx' command to run `node-gyp rebuild',
> should I be using that?

The npmrc configuration will only work of node-gyp is run through npm 
(or npx): https://github.com/nodejs/node-gyp#npm-configuration

In general, my current understanding is that you shouldn't have to run 
`node-gyp configure` explicitly. First, `node-gyp rebuild` includes a 
`node-gyp configure` step, but, more broadly, Guix's configure and build 
phases should usually do any needed addon building automatically. Aside 
from packages that deleted the configue phase, the main exception I've 
found is packages that try to use some strategy for downloading 
pre-built binaries: in some cases I've patched them enough to make 
automatic compilation work, but maybe sometimes just doing things 
manually is less work. If you do need to run `node-gyp` explicitly, the 
`npx` approach is the best I've found.

-Philip