[Buildroot] [PATCH 3/4] package/nodejs: add patch to adjust default NodeJS search path

Thomas Petazzoni thomas.petazzoni at bootlin.com
Sun Sep 25 19:23:23 UTC 2022


On Sun, 25 Sep 2022 20:15:57 +0200
"Yann E. MORIN" <yann.morin.1998 at free.fr> wrote:

> It looks like this is an array, so maybe we could keep the original
> path, and add the npm installation path:
> 
>     const paths = [path.resolve(prefixDir, 'lib', 'node'),
>                    path.resolve(prefixDir, 'lib', 'node_modules'),];
> 
> This, in case some ot-of-tree packages simply copy files into the
> original .../node/ directory.

Good point, I've sent a v2 which does exactly this.

> Alternatively, we could symlink node_modules to node.

I did consider the symlink solution as well, but I worried (perhaps
wrongly, or too conservatively) that it could get removed. Or it would
have to be the other way around: node -> node_modules, as npm installs
in node_modules and I would be worried of npm being unhappy with
installing inside a path that contains a symlink.

Overall, I found patching the search path to be safer, but if the
symlink solution is preferred, I can definitely implement it.

Best regards,

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com



More information about the buildroot mailing list