Skip to content

Pattern npm

m-wells edited this page Feb 21, 2026 · 2 revisions

npm Packages

Example: gemini-cli

npm packages bundle all dependencies within node_modules/, making them self-contained.

Template

arch=('any')
depends=('nodejs')
makedepends=('npm')

source=("https://registry.npmjs.org/@scope/package/-/package-${pkgver}.tgz")

package() {
    npm install -g --prefix "${pkgdir}/usr" \
        --cache "${srcdir}/npm-cache" \
        "${srcdir}/${pkgname}-${pkgver}.tgz"
}

Characteristics

  • arch=('any') - JavaScript is platform-independent
  • Only runtime dep is nodejs
  • Dependencies bundled in package (not system packages)
  • Source is pre-built tarball from npm registry

Wrapper Scripts

If the package emits deprecation warnings (common with latest Node.js), replace the symlink with a wrapper:

#!/bin/bash
export NODE_OPTIONS="--no-deprecation"
exec /usr/lib/node_modules/package/bin/entry.js "$@"

Version Checking

# scripts/packages/example.sh
check_npm "example" "@scope/package"

Clone this wiki locally