Nub has its own install engine: it resolves the dependency graph, writes the lockfile, and links node_modules. Its CLI follows pnpm's, so the verbs and flags are the ones you already type.

nub install               # install what package.json declares
nub add react react-dom   # add dependencies
nub update --latest       # move ranges to the newest release
nub dedupe                # collapse duplicate versions

A project Nub owns gets a nub.lock. In a repo that already uses npm, pnpm, Yarn, or Bun, Nub installs with that tool's lockfile instead — see lockfile compatibility.

CLI

Each command takes pnpm's flags, with the same spelling.

nub install

Resolves the graph and links node_modules:

nub install                      # alias: nub i
nub install --frozen-lockfile    # fail if the lockfile is out of date
nub install -P                   # --prod / --production
nub install -D                   # dev only
nub install --node-linker hoisted
nub ci                           # clean install from the lockfile
nub ci -P                        # clean install, no devDependencies

The accepted flags are pnpm's spellings:

--frozen-lockfile / --no-frozen-lockfile / --prefer-frozen-lockfile
--fix-lockfile        # rewrite the lockfile, keeping its pinned versions
--prod, -P            # production install
--dev, -D
--ignore-scripts
--pnpmfile <path>     # run this one instead of the project's
--global-pnpmfile <path>
--ignore-pnpmfile
--no-optional
--offline / --prefer-offline
--lockfile-only
--force
--node-linker
--registry
--dir, -C             # pnpm's spelling, not npm's --prefix
--reporter <name>     # default, append-only, silent
--silent, -s          # alias for --reporter=silent
--loglevel <level>    # debug, info, warn, error, silent
--os <os>             # which platforms' optional deps to install
--cpu <arch>
--libc <libc>

Packages like esbuild and rollup ship one prebuilt binary per platform as optional dependencies, and an install picks the one matching the current machine. Pass --os, --cpu, or --libc to pick a different one, for example when building a Linux container image on a Mac:

nub install --os linux --cpu x64        # Linux x64 binaries
nub install --os linux                  # Linux binaries, host CPU
nub install --os current,linux          # this machine and Linux
nub install --os '*' --cpu '*'          # every platform variant

Each flag is repeatable and takes a comma-separated list. A flag overrides supportedArchitectures for the axis it names, for that run only.

Three flags control output. Each works on every install-family command, before or after the verb:

nub install --silent                # -s: only fatal errors
nub install --reporter=append-only  # no live progress, keeps the summary
nub install --loglevel error        # hide warnings

In a workspace, install and ci take the same selector flags as script running:

--filter <sel>, -F        # pnpm's selector grammar
--recursive, -r           # every workspace package
--filter-prod <sel>       # selector, production deps only
--include-workspace-root  # add the root package to the recursive set
--fail-if-no-match        # error if the filter selects zero packages

nub add

Resolves a package, links it, and writes the dependency into package.json:

nub add <pkg>                  # alias: a
nub add -D <pkg>               # --save-dev
nub add -E <pkg>               # --save-exact (pin, no ^)
nub add -O <pkg>               # --save-optional
nub add --save-peer <pkg>      # peer + dev dependencies (pnpm parity)
nub add --save-types <pkg>     # also save its @types/* package
nub add -g <pkg>               # global install
nub add -w <pkg>               # write to the workspace root
nub add --save-catalog <pkg>   # add into the workspace catalog
nub add --allow-build=<pkg>    # pre-approve its build scripts
nub add --allow-similar-name <pkg>  # clear the name check for this run
nub add --no-save <pkg>        # link without persisting to package.json
nub add <pkg>@<version>        # pin an exact version
nub add <pkg>@<tag>            # a prerelease saves exact, a stable tag ^
nub add <pkg>@<version> --lockfile-only  # refresh the lockfile only

nub remove

Drops a dependency from package.json and relinks node_modules:

nub remove <pkg>           # rm / uninstall / un / uni
nub remove -D <pkg>        # remove only from devDependencies
nub remove -g <pkg>        # remove a global package
nub remove -w <pkg>        # remove from the workspace root

nub update

Re-resolves dependencies within their ranges and raises each ^/~ range to the version it resolved. With --latest, it rewrites ranges to the newest release. A catalog: dependency's range is rewritten in the catalog that defines it, so every project using that entry moves together:

nub update                 # up — refresh all deps within range
nub update <pkg>           # update a single dependency
nub update <pkg>@<version> # pin one dep, keeping its ^/~ operator
nub update <pkg>@<tag>     # move one dep to a dist-tag, exact
nub update -i              # --interactive: pick each package's target
nub update -L              # --latest: move past the manifest range
nub update -E -L           # pin the rewritten range to an exact version
nub update -D              # devDependencies only
nub update -P              # production only
nub update --lockfile-only # refresh the lockfile, leave node_modules alone

In a workspace, nub update acts on the project you run it in, so at the workspace root it updates the root's own dependencies and every other project keeps its locked versions. To update a package a member declares, select the member with --filter, or pass -r to update it in every project that has it:

nub --filter frontend update @sveltejs/kit
nub update -r @sveltejs/kit

The interactive picker shows one row per outdated dependency:

Choose dependency updates
                                         keep             latest in range   latest
  dependencies
❯   @effect/opentelemetry@^4.0.0-beta.1  ■ 4.0.0-beta.90  □ 4.0.0-beta.100  □ 4.0.0-beta.100
    chalk@^4.1.0                         ■ 4.1.0          □ 4.1.2           □ 5.6.2
    react@^17.0.0                        ■ 17.0.1         □ 17.0.2          □ 19.2.8
  devDependencies
    typescript@~5.3.0                    ■ 5.3.2          □ 5.3.3           □ 7.0.2
↑/↓ move · space/←/→ cycle · a cycle all · / filter · enter apply · esc cancel
  • Space, ←, or → cycles a row between the current version, the newest version inside the range, and the registry's latest.
  • Nothing is selected by default. Enter updates only the rows you changed.
  • Targets are colored by semver impact.
  • Each spec keeps its style: a ^ range stays ^, and an exact pin stays exact.

nub dedupe

Collapses duplicate versions in the lockfile to fewer, shared resolutions:

nub dedupe          # rewrite the lockfile with deduped resolutions
nub dedupe --check  # CI: exit non-zero if dedupe would change anything

nub import

Converts another package manager's lockfile to pnpm-lock.yaml, without installing:

nub import          # package-lock / yarn.lock / bun.lock → pnpm-lock
nub import --force  # overwrite an existing pnpm-lock.yaml

Other commands

The rest of pnpm's verb set:

why          outdated      list, ls
patch        patch-commit  patch-remove
approve-builds  prune      rebuild
fetch        link, unlink  audit
licenses     bin           root
store        config        pkg
publish      pack          dlx          create

The package meta-manager, nub pm, is a separate tool. It fetches and runs the exact pnpm, npm, or Yarn release a project pins, as corepack does.

Global installs

Passing -g installs a package for your user rather than a project, and links its executables onto your PATH:

nub add -g cowsay          # or: nub install -g cowsay
cowsay hello

nub remove -g cowsay
DefaultPurpose
Executables~/.local/binShared with every tool that installs there, and already on PATH on most systems
Packages$XDG_DATA_HOME/nub/globalNub's own, beside the content store

Nub picks the executable directory from, in order:

  • XDG_BIN_HOME
  • $XDG_DATA_HOME/../bin
  • ~/.local/bin

Point it elsewhere with a setting:

nub config set --global global-bin-dir ~/bin

Run nub bin -g to print the directory in use, and nub root -g for where the packages live.

PATH setup

Most Linux distributions already put ~/.local/bin on PATH; macOS does not. When the directory is missing from PATH after a global install, Nub adds it to your shell profile and says so:

$ nub add -g cowsay
Linked 2 bins into /Users/you/.local/bin
  PATH: added /Users/you/.local/bin to /Users/you/.zshrc
  Restart your shell, or source that file, to pick it up.

Nub writes the line once, under a # nub global bin marker, for bash, zsh, and fish. When it cannot write a profile, it prints the line to add by hand.

Name collisions

The executable directory is shared, so a name may already be taken. Nub replaces an entry only when it created that entry itself; otherwise it keeps your file and says what it skipped:

$ nub add -g cowsay
warning: not linking cowsay — /Users/you/.local/bin/cowsay already
exists and was not created by this tool; remove it to link cowsay

Resolution

Resolution decides which version of each package ends up in the graph. Every field below lives in package.json.

overrides

Force one version of a package everywhere in the graph. A selector is a bare name, a name with a range to match, a path that scopes the pin to one parent, or $name to reuse your own dependency's range.

package.json
{
  "overrides": {
    "is-number": "7.0.0",
    "is-number@^6.0.0": "7.0.0",
    "is-odd>is-number": "7.0.0",
    "semver": "$semver"
  }
}

Read the full docs on pnpm.io.

resolutions

The same pins in Yarn's spelling, with the same selectors. When both fields pin a package, overrides wins.

package.json
{
  "resolutions": {
    "is-odd>is-number": "7.0.0"
  }
}

Read the full docs on yarnpkg.com.

packageExtensions

Patch a dependency's own manifest at resolve time, adding to its dependencies, optionalDependencies, peerDependencies, or peerDependenciesMeta. Use it when a published package declares a peer it doesn't need, or omits one it does. An extension only adds what is missing and never replaces a declared range.

package.json
{
  "packageExtensions": {
    "[email protected]": {
      "peerDependenciesMeta": {
        "react": { "optional": true }
      }
    }
  }
}

Read the full docs on pnpm.io.

The top-level field applies in a Nub-owned project. A pnpm project uses pnpm.packageExtensions, and a Yarn project uses packageExtensions in .yarnrc.yml.

Nub also applies a bundled database of these repairs, so most undeclared dependencies resolve with no configuration. It covers what Nub's phantom detector finds across the 10,000 most-downloaded packages on npm, plus every rule from Yarn's curated database. It ships separately as @nubjs/extensions for other tools to read.

.npmrc
# resolve every manifest exactly as published, repairing nothing
ignore-compatibility-db=true

patchedDependencies

Apply a patch file to a package's contents, keyed by name and version. nub patch <pkg>@<version> opens an editable copy of the package, and nub patch-commit writes the patch and this entry. Patching the same package again starts from its patched files, and the commit rewrites the patch with all of the changes. A key that matches no installed package fails the install.

package.json
{
  "patchedDependencies": {
    "[email protected]": "patches/[email protected]"
  }
}

Read the full docs on pnpm.io.

workspaces

Monorepo member globs. Members resolve to each other through a workspace: specifier instead of the registry.

package.json
{
  "workspaces": ["packages/*"]
}

Read the full docs on docs.npmjs.com.

workspaces.catalog

Name a version once and let every member reference it. The default catalog is catalog:, and a named catalog is catalog:<name>. A reference to an undefined entry fails the install.

package.json
{
  "workspaces": {
    "packages": ["packages/*"],
    "catalog": { "react": "19.2.0" },
    "catalogs": { "testing": { "vitest": "3.2.4" } }
  }
}
packages/app/package.json
{
  "dependencies": { "react": "catalog:" },
  "devDependencies": { "vitest": "catalog:testing" }
}

Read the full docs on pnpm.io. The catalog: syntax matches pnpm's; the definitions live in package.json rather than pnpm-workspace.yaml.

allowScripts

Which dependencies may run install scripts — see lifecycle scripts. The field applies in every project, whichever tool owns it. A registry dependency is keyed by name and anything else by its full specifier, a git dependency also by its repository (see git dependencies), and a false beats any allow:

package.json
{
  "allowScripts": {
    "esbuild": true,
    "sharp": false,
    "buildy@file:buildy-1.0.0.tgz": true
  }
}

Version 12 of npm gates its own install scripts on this same field, so one map covers both tools. Read npm's approve-scripts docs.

dependenciesMeta

Per-dependency flags. Setting injected hard-copies a workspace dependency instead of linking it, and built: false denies that package's install scripts.

package.json
{
  "dependenciesMeta": {
    "ui": { "injected": true },
    "esbuild": { "built": false }
  }
}

Read the full docs on pnpm.io.

peerDependenciesMeta

Mark one of your own peer dependencies optional, so a consumer that doesn't install it gets no error.

package.json
{
  "peerDependencies": { "react": "^19.0.0" },
  "peerDependenciesMeta": {
    "react": { "optional": true }
  }
}

Read the full docs on pnpm.io.

allowedDeprecatedVersions

Which deprecated versions may resolve without a warning, by package and range.

package.json
{
  "allowedDeprecatedVersions": {
    "request": "*",
    "lodash": "<4.0.0"
  }
}

Read the full docs on pnpm.io.

engines

The Node and package-manager versions the project requires. Nub provisions the Node named here, and engineStrict decides whether a mismatch warns or fails.

package.json
{
  "engines": {
    "node": ">=22.15"
  }
}

Read the full docs on pnpm.io.

Settings

Registries, auth, peer-dependency behavior, and save behavior come from .npmrc and npm_config_* environment variables, in every project. The setting names are pnpm's:

KeyReference
resolutionModepnpm.io
autoInstallPeerspnpm.io
strictPeerDependenciespnpm.io
dedupePeerDependentspnpm.io
resolvePeersFromWorkspaceRootpnpm.io
linkWorkspacePackagespnpm.io
saveWorkspaceProtocolpnpm.io
savePrefixpnpm.io
saveExactdocs.npmjs.com
saveTypespnpm.io
supportedArchitecturespnpm.io
ignoredOptionalDependenciespnpm.io
minimumReleaseAgepnpm.io
minimumReleaseAgeExcludepnpm.io
engineStrictpnpm.io
registries, namedRegistriespnpm.io

Nub's own config file, nub.jsonc, adds four install fields. The layout fields linker and publicHoist apply in every project. The cooling-window fields minimumReleaseAge and minimumReleaseAgeExclude apply only when Nub owns the project.

Layout

The default node_modules layout is isolated under every incumbent: direct dependencies sit at the top level, and everything else links from a virtual store. A project that relies on undeclared (phantom) dependencies can switch to npm's flat layout:

.npmrc
node-linker=hoisted

The --node-linker hoisted flag does the same for one command, and install.linker sets it in nub.jsonc. When an undeclared package fails to resolve at runtime, Nub's error names it and points at this setting.

Store and layout covers the shared store, the hoisting settings, and where Nub keeps packages on disk.

Lifecycle scripts

Dependencies can declare preinstall, install, and postinstall scripts. Nub denies them by default, and you allow the packages that may build:

nub approve-builds                # approve packages, then build them
nub add --allow-build=<pkg> <pkg> # pre-approve as you add it
nub rebuild                       # re-run already-approved scripts
nub install --ignore-scripts      # skip dependency build scripts

Approving builds runs the approved packages' scripts in the same invocation, as pnpm does. No follow-up install is needed.

Permission comes from the allowScripts field in any project. A project owned by another package manager can also use that tool's own field:

  • pnpm: pnpm.onlyBuiltDependencies, pnpm.allowBuilds
  • Bun: trustedDependencies

dangerouslyAllowAllBuilds=true runs every build script except the ones denied.

Unapproved build scripts

An install that meets a build script nobody has approved fails with ERR_NUB_IGNORED_BUILDS, as pnpm does. It fails last, once node_modules is linked and the approved builds and your project's own scripts have run, so the only step left is the decision:

# captured: nub 0.9.7 dev build, [email protected] — no allowScripts entry
$ nub install
dependencies:
+ [email protected]

ERR_NUB_IGNORED_BUILDS

  × Ignored build scripts: [email protected]
  help: Run `nub approve-builds` to pick which dependencies may run their
        build scripts, or set `strictDepBuilds=false` to install without them.

Approve the package with nub approve-builds, or deny it to keep it skipped: nub approve-builds '!<pkg>' and nub add --allow-build='!<pkg>' both record false. --allow-build will not approve a package the project already denies; change that entry instead. To skip unapproved builds with a warning rather than fail, set strictDepBuilds=false in .npmrc. Global installs and nubx never fail on one.

nub rebuild <pkg> re-runs an approved package's build. Naming a package there does not approve it.

Git dependencies

A dependency installed from git is source, not a published build. When it has a prepare script, Nub builds it before linking it: it installs the checkout's own dependencies, runs prepare, and links what the package would publish. That build runs only when allowScripts names the dependency's source, as in pnpm:

package.json
{
  "allowScripts": {
    "rimraf@git+https://github.com/isaacs/rimraf.git": true
  }
}

A <name>@git+<repository> key approves every commit of that repository, and a key ending in #<commit> approves that commit alone. A bare package name never approves a git dependency. A git dependency that needs building and is not listed fails the install with ERR_NUB_GIT_DEP_PREPARE_NOT_ALLOWED, which prints the key to add. One set to false installs unbuilt, as every git dependency does under --ignore-scripts.

Your project's own hooks

Hooks in your own package.json need no approval. They run in the root and in every workspace member, in pnpm's order, once dependencies are linked:

preinstall → install → postinstall
  → preprepare → prepare → postprepare

Members run in dependency order, each after the members it depends on. The root's preinstall runs first, before anything is resolved, so a guard such as npx only-allow pnpm can stop the install. With --filter, only the root and the selected members run their hooks.

CommandHooks
nub install, a bare nub updateall six
nub install --prodpreinstall, install, postinstall
nub remove <pkg>preuninstall and uninstall before the package is unlinked, postuninstall after
nub add <pkg> in a workspacepreinstall, install, postinstall, in the root and the project you add to
nub add <pkg> in a single project, nub update <pkg>, nub rebuildnone

--ignore-scripts skips all of them.

Build failures

A failed build fails the install. The exception is a package reachable only through optionalDependencies: its failure is reported and the install continues, as in npm and pnpm.

# captured: nub 0.7.5, [email protected] postinstall exits 3, allowScripts set
$ nub install
WARN [email protected] is an optional dependency and failed to build;
     continuing without it: lifecycle script postinstall failed for
     [email protected]: script `postinstall` exited with code 3
     code=WARN_NUB_OPTIONAL_BUILD_FAILED
optionalDependencies:
+ [email protected]

A package that anything depends on through a normal dependency is required, even if another package depends on it optionally. The warning appears only on the install that ran the build. Run nub rebuild <pkg> to try the build again.

Default-trust floor

A curated set of well-known packages, such as esbuild, may build without approval. All three gates must hold:

GateRequirement
Registry provenanceResolved from a registry. Git, file, link, tarball, and npm-alias specifiers never qualify.
Advisory vettingThe advisory check ran against this graph, or the graph came from an already-checked lockfile (a frozen install, nub ci, a teammate's clone).
Cooling windowThe version is older than the cooling window. An unknown publish time fails the gate for a newly resolved version; a version kept from the existing lockfile passes it.

Explicit decisions outrank the floor: a package you approve always builds, and an explicit denial always wins.

A fresh resolve or an existing lockfile gives the floor what it needs:

# captured: nub 0.0.44, pnpm, [email protected] — no allowScripts entry
$ nub install
WARN defaultTrust: running build scripts for [email protected]  # ✓ gates ok
dependencies:
+ [email protected]

When a gate fails, the package is an unapproved build like any other. Exempting esbuild from a long cooling window lets it resolve, but the floor still checks the window, so it fails closed:

# captured: nub 0.9.7 dev build, [email protected], fresh resolve —
# minimumReleaseAge=2000000, minimumReleaseAgeExclude=esbuild,@esbuild/*
$ nub install
dependencies:
+ [email protected]  latest 0.28.2

ERR_NUB_IGNORED_BUILDS

  × Ignored build scripts: [email protected]   # ❌ cooling gate closed
  help: Run `nub approve-builds` to pick which dependencies may run their
        build scripts, or set `strictDepBuilds=false` to install without them.

Supply-chain checks

Three checks apply when Nub resolves a new version: a minimum age, a malware advisory lookup, and a comparison of publishing evidence.

Cooling window

A registry version must be older than minimumReleaseAge, 24 hours by default, before Nub installs it. When nothing in the range is old enough, the install fails.

Adding a package without naming a version resolves to the newest release that clears the window:

$ nub add some-tool
+ [email protected]  latest 2.4.0   # 2.4.0 is still inside the window

The nub outdated command follows the same rule, so it never offers a version inside the window.

Two flags adjust the window for one command:

$ nub add some-tool
ERR_NUB_NO_MATURE_MATCHING_VERSION       # ❌ every version is too new

$ nub add some-tool --minimum-release-age=0                 # off, this run
$ nub add some-tool --minimum-release-age=2h                # or shorten it
$ nub add some-tool --minimum-release-age-exclude=some-tool # exempt one

The duration takes a unit (s, m, h, d, or w), and a bare number means minutes, as in pnpm. Both flags work on every command that installs, including nubx.

The exclude flag replaces the configured minimumReleaseAgeExclude for that run, as in pnpm. Name every package you still need:

$ nub add some-tool --minimum-release-age-exclude='@internal/*' \
    --minimum-release-age-exclude=some-tool

Publish dates come from the registry's time metadata:

Registry metadataOutcome
A publish date for the resolved versionChecked against the window
Dates for other versions, none for this oneBlocked
No per-version dates, document older than the windowAllowed
No per-version dates, document newer than the windowBlocked

Some private mirrors and older Verdaccio releases publish no dates at all, so they fall under the last row. That refusal is ERR_NUB_RELEASE_AGE_MISSING_TIME, and nub outdated warns about it on stderr:

$ nub outdated
warn: internal-pkg has no registry publish times, so minimumReleaseAge
      cannot admit any version; `nub update` will fail for it
All dependencies up to date.

Exempt the package, or turn the window off:

.npmrc
minimumReleaseAgeExclude=internal-pkg   # exempt one (comma-separated)
minimumReleaseAge=0                     # turn the window off

Nub also reads pnpm's minimumReleaseAgeStrict=false. That setting counts an undateable version as clearing the window, so the window looks enforced but is not. Prefer minimumReleaseAge=0.

Advisory gate

On a fresh resolve, Nub checks the graph against OSV MAL-* advisories at api.osv.dev. A confirmed hit aborts the install with ERR_NUB_MALICIOUS_PACKAGE. When osv.dev is unreachable, the check warns and the install proceeds. To fail instead:

.npmrc
advisoryCheck=required

A frozen reinstall (nub ci, --frozen-lockfile, a teammate's clone) reuses the vetting recorded when the lockfile was written. The cooling and provenance gates still apply on every install.

New names

nub add questions a name you typed before it adds a public npm package. In a terminal it asks you to confirm, and without one it refuses:

CheckRefuses whenErrorFlag for one run
Similar nameThe name resembles one of the 100,000 most-downloaded packagesERR_NUB_SIMILAR_PACKAGE_NAME--allow-similar-name
New nameThe name was first published within minimumPackageAge, 30 days by defaultERR_NUB_NEW_PACKAGE_NAME--allow-new-name
Low downloadsThe package has fewer than lowDownloadThreshold weekly downloads, 1,000 by defaultERR_NUB_LOW_DOWNLOAD_PACKAGE--allow-low-downloads

--allow-low-downloads also clears the other two checks. Packages already in the lockfile are exempt, and nub install, nub ci and nubx skip these checks.

To keep a package allowed, list it in .npmrc. Entries are comma-separated globs:

.npmrc
allowedUnpopularPackages=reylo,@reylosql/*

A project that keeps its pnpm settings in pnpm-workspace.yaml can list it there instead. The advisory gate still applies to every package on the list.

Trust downgrades

Nub compares a version's trust evidence with earlier releases of the same package: OIDC provenance, a trusted publisher, a staged-publish approval. A version with weaker evidence than an earlier-published version is refused. A pipeline that suddenly publishes without its usual attestation is a common sign of a stolen token.

Nub then takes the best version in the range that still carries the evidence, and names what it skipped:

# captured: fast-glob → @nodelib/fs.walk → fastq; 1.20.2 hand-published
$ nub install
WARN skipped [email protected] (trustPolicy=no-downgrade): earlier published
     version 1.20.0 had trusted publisher but this version has no trust
     evidence; resolved to [email protected] instead
     code=WARN_NUB_TRUST_DOWNGRADE_SKIPPED

The substitute always satisfies the declared range. When no version in the range clears the check, the install stops with ERR_NUB_TRUST_DOWNGRADE. The check runs only when a version is newly resolved, so an install from an up-to-date lockfile trusts its recorded pins.

A maintenance release on an older major, published after a newer major adopted provenance, can trip the check. Versions older than 14 days are exempt. Adjust the check in .npmrc:

.npmrc
trustPolicyIgnoreAfter=20160        # exemption, minutes (default 14d)
trustPolicyExclude=tailwind-merge   # exempt one package regardless of age
trustPolicy=off                     # disable the check entirely

Lockfile compatibility

In a repo that already uses npm, pnpm, Yarn, or Bun, Nub installs as that package manager: same lockfile format, same config files, same manifest fields. It writes no nub.lock there. Nub identifies the incumbent from, in order:

  • packageManager
  • devEngines.packageManager
  • Lockfile on disk

In a workspace, Nub reads these at the root, from any member.

IncumbentLockfileRound-trip
npm — docs →package-lock.json, npm-shrinkwrap.jsonread + write
pnpm — docs →pnpm-lock.yaml (v9)read + write
Yarn — docs →yarn.lockread-only
Bun — docs →bun.lockread + write
Nub — docs →nub.lock (pnpm v9 bytes)read + write

An install that leaves the graph unchanged leaves the lockfile untouched.

Optional

The installer is optional. Keep running npm, pnpm, yarn, or bun as you do today, and use Nub for everything else — running files, scripts, and binaries.

Config it reads

Under each incumbent, Nub reads that tool's branded config and no other's. It reads .npmrc and npm_config_* under every incumbent. Hover a partial chip for the breakdown; each incumbent's page has the full table.

Package managerConfig it reads
npmpackage-lock.json. Supported. v1 / v2 / v3 read; legacy v1 git/file: deps need a re-lock.npm-shrinkwrap.json. Supported.npmrc. Supportedoverrides. Supportedworkspaces. Supportedengines / os / cpu / libc. Supportednpm_config_*. Supported. Registry-client keys only.
pnpmpnpm-lock.yaml. Supported. v6/v5.4 declined — re-lock under pnpm 9+.pnpm-workspace.yaml. Supported. Workspace and resolution settings; layout keys are not read..pnpmfile.cjs. Supported.npmrc. Supportedpackage.json#pnpm. Supportedpnpm.overrides. Supportedpnpm.packageExtensions. Supportedpnpm.patchedDependencies. Supportedresolutions. Supportedcatalog:. Supportedworkspace:. Supportedworkspaces. SupporteddependenciesMeta.injected. Supportedengines / os / cpu. Supportedpnpm_config_*. Supported. Generic settings under any pnpm version; registry-client keys (registry, proxy, strict-ssl) under pnpm v11+.npm_config_*. Supported
Yarnread-only.npmrc. Supportedresolutions. Supportedcatalog:. Supported. Berry (v2+); a 1.x pin refuses, since Yarn classic has no catalogs.workspace:. Supportedworkspaces. SupportedpackageExtensions. SupporteddependenciesMeta.built. Supportedengines / os / cpu. Supportedyarn.lock. Partially supported. Read-only; writes refused..yarnrc.yml. Partially supported. Not read: per-host proxies, nodeLinker and the layout keys..yarnrc. Partially supported. Registry and auth keys only.YARN_*. Partially supported. Reads the registry, auth token/ident, CA file, proxy, and strict-SSL env values; map-shaped and scoped env config is not translated.nodeLinker: pnp. Not supported. Refused before any write — Berry's default and an explicit pnp both abort.
Bunbun.lock. SupportedtrustedDependencies. Supportedoverrides. Supportedresolutions. SupportedpatchedDependencies. Supportedcatalog:. Supportedworkspace:. Supportedworkspaces. Supportedengines / os / cpu. Supportedbunfig.toml. Partially supported. [install] section only, minus linker — use the neutral .npmrc key or CLI flag.BUN_CONFIG_*. Partially supported. Registry and token only.bun.lockb. Not supported. Binary lockfile rejected — convert to bun.lock text first.

A field the incumbent would ignore, Nub ignores too, and it says which field it skipped. In a pnpm project, a top-level overrides block changes nothing, because pnpm reads resolutions and pnpm.overrides:

# captured: nub 0.7.2, pnpm project with a top-level overrides block
$ nub install
nub: `overrides` ignored — this project uses pnpm, which doesn't apply
it. move these pins to `resolutions`.
dependencies:
+ [email protected]

Declaring the same pin in both fields stays silent. A Nub-owned project reads no tool's branded config, including pnpm.* fields, pnpm-workspace.yaml, and .pnpmfile.cjs. To keep pnpm hooks or pnpm workspace config active, keep the project pnpm-owned or run nub pm use pnpm.

Layout settings

Nub does not read layout settings from an incumbent's branded config. It reads the rest of that config (registries, auth, resolution settings, overrides) as usual.

Package managerIts own layout settingsUnder Nub
npminstall-strategy, global-style, legacy-bundlingNot read
pnpmnodeLinker, hoist, symlink, and related keys in pnpm-workspace.yaml or global config.yamlNot read
YarnnodeLinker, nmHoistingLimits, nmModeNot read. Plug'n'Play is refused before any write, because Nub installs a node_modules tree
Bunlinker, under [install] in bunfig.tomlNot read

Set layout with install.linker and install.publicHoist in nub.jsonc, their .npmrc spellings, or command-line flags. These work under every incumbent. Nub warns when it finds a branded layout setting.

Switching to Nub

Running nub pm use nub moves a project onto Nub: it migrates pnpm workspace config into the neutral package.json fields, aligns the manifest, and writes nub.lock. A first nub install in a project with no declaration and no lockfile does the same.

Either way, Nub records itself with a range rather than an exact pin. The caret is a floor, and "onFail": "ignore" means nothing enforces it:

package.json
{
  "devEngines": {
    "packageManager": {
      "name": "nub",
      "version": "^0.7.1",
      "onFail": "ignore"
    }
  }
}

To pin an exact version that corepack can see, run nub pm use nub@<version>. Config that a Nub-owned project no longer reads produces a warning:

# captured: Nub-owned project (nub.lock) with a stray pnpm-workspace.yaml
$ nub install
nub: pnpm-workspace.yaml is not read under nub identity — migrate it
     (`nub pm use nub`), delete it, or return to pnpm (`nub pm use pnpm`).

Conflicting signals

When the signals disagree, Nub stops rather than guess. Two lockfiles for different managers are an error unless a declaration names one of them:

$ nub install
Error: ERR_NUB_LOCKFILE_AMBIGUOUS

  × multiple lockfiles found: pnpm-lock.yaml, package-lock.json —
  │ cannot tell which package manager owns this project
  help: remove the stale lockfile, or run nub pm use <pm> naming a specific
        manager

A hosted builder that runs its own install beside your committed lockfile is a common cause. See Cloudflare for the build-level fix. In a Nub-owned project, nub.lock beside a foreign lockfile is the same error.

A declaration whose lockfile is missing is also an error:

$ nub install   # packageManager: "[email protected]"
Error: ERR_NUB_LOCKFILE_DECLARATION_MISMATCH

  × package.json declares `pnpm` (via `packageManager`), but
  │ pnpm-lock.yaml is missing — found package-lock.json instead
  help: nub pm use <pm> to declare it, or remove the stale lockfile