Re: Software distributed via npm?

Jonathan Perkin <[email protected]> Sun, 12 Apr 2026 18:15:20 +0100
Newsgroups gmane.os.netbsd.devel.packages
Message-ID <[email protected]>
* On 2026-04-12 at 16:57 BST, Thomas Klausner wrote:

>On Sun, Apr 12, 2026 at 03:42:29PM +0100, Benny Siegert wrote:
>> I am using a few command-line tools that are meant to be installed with "npm
>> install". If I use "npm install -g", the tool is installed into
>> /usr/pkg/bin, without being tracked by the pkgsrc infrastructure. This seems
>> bad.
>
>This is much more complicated, because npm likes to install all the
>dependencies for a package for each package.
>
>Take a look at wip/prettier for a working npm package.
>
>I didn't take this further because many packages directly or
>indirectly depend on non-portable software that needs to be compiled,
>and since every npm package pulls in its own copy, the patches for
>this need to be distributed all over.
>
>It would be nice to have an npm that installs into a common prefix and
>all packages using a dependency could use it from there, but that is
>just not the npm that exists.

There are other issues, 'npm install -g' is just broken out of the box 
(plenty of bug reports over the last decade with bad interaction between 
sudo and EPERM), and you also have the problem that a lot of 
npm-installed software likes to automatically update itself, and that 
would break pkgsrc checksums.

FWIW you'll have a much nicer experience if you

   $ npm config set prefix=~/.local/npm

and then 'npm install -g' will actually work.  Add ~/.local/npm/bin to 
$PATH.

-- 
Jonathan Perkin                    pkgsrc.smartos.org
Open Source Complete Cloud   www.tritondatacenter.com