tech-pkg archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Software distributed via npm?
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.
>
> I noticed that the installation instructions for Gemini CLI tell you to use
> npm install, or (on Mac) install from MacPorts or Homebrew. These ports
> trees evidently have handling for this kind of software. As far as I am
> aware, pkgsrc does not.
>
> In practice, I think that this could work roughly like this:
>
> - run npm install with some sort of environment setup so that it installs
> into ${DESTDIR}${PREFIX}
> - symlink binaries into bin
> - use a dynamic PLIST covering all the installed files
>
> What is not clear to me is how to match what npm does to pkgsrc's definition
> of fetch / build / install phases.
>
> Any ideas? Is there prior art in pkgsrc?
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.
Thomas
Home |
Main Index |
Thread Index |
Old Index