Skip to content

npm ci fails offline: onnxruntime-node postinstall fetches CUDA/TensorRT binaries from api.nuget.org by default #73

Description

@pinecone-groundskeeper

Problem

onnxruntime-node (currently resolved to 1.27.0 via the ^1.15.0 range in
package.json) runs a postinstall script (node ./script/install) that, on
linux/x64, unconditionally attempts to download the CUDA/TensorRT execution
provider binaries (libonnxruntime_providers_cuda.so,
libonnxruntime_providers_tensorrt.so, libonnxruntime_providers_shared.so)
from a NuGet feed at `(api.nuget.org/redacted) — unless the
installer is explicitly told to skip.

This is driven by script/install-metadata.js in the installed package, which
hardcodes:

requirements: {
  'linux/x64': ['cuda12'],
  ...
}

script/install.js only skips this download if ONNXRUNTIME_NODE_INSTALL (or
the npm config equivalent) is explicitly set to skip — there is no such
opt-out configured anywhere in this repo (no .npmrc, no env var). If the
NuGet feed is unreachable — any network-restricted CI runner, corporate proxy,
sandboxed/offline environment, or Docker build with locked-down egress — the
download throws and npm ci/npm install fails outright with:

npm error Error: getaddrinfo EAI_AGAIN api.nuget.org
npm error path .../node_modules/onnxruntime-node
npm error command sh -c node ./script/install

Reproduced on a clean checkout: npm ci fails with the error above. Setting
ONNXRUNTIME_NODE_INSTALL=skip npm ci succeeds cleanly (385 packages
installed, 0 vulnerabilities), and with that skip in place npm run typecheck, npm test (23/23 passing), npm run lint, and npm run format:check all pass without issue — confirming the project only needs the
bundled CPU execution provider. Nothing in src/ configures or uses a CUDA
execution provider; src/embeddings.ts runs @huggingface/transformers with
the default (CPU) backend.

This doesn't currently break this repo's own CI (ubuntu-latest
GitHub-hosted runners have unrestricted internet access to nuget.org), but it
makes npm install fragile for anyone following the README's npm install
step from a network-restricted environment — exactly the kind of place a
"just clone and run this example" tutorial gets used (corporate networks,
egress-locked CI, offline dev containers).

Acceptance criteria

  • Adding an .npmrc entry (or equivalent) that sets the package-specific
    onnxruntime-node:onnxruntime_node_install=skip config so a clean
    npm ci/npm install no longer attempts to contact api.nuget.org.
  • npm ci succeeds on a clean checkout with no other environment variables
    set.
  • npm run typecheck, npm test, npm run lint, and npm run format:check
    all still pass after the change (they exercise only the CPU embedding path,
    so behavior should be unaffected).

Scope

Only the onnxruntime-node postinstall CUDA-download behavior is in scope —
add the minimal config needed to opt out of the unused GPU binary fetch.
Do not touch unrelated dependency versions, CI workflow content, or any other
package's install behavior; those are tracked separately.

Generated by GitHub Maintenance Audit · sonnet50 · 104 AIC · ⌖ 5.93 AIC · ⊞ 7.9K · ◷

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent:maintenance-auditFiled by the maintenance audit agent; it recognizes its own backlog by this labelmaintenanceIn scope for the maintenance agentneeds-human-reviewFlagged by the maintenance agent as ambiguous or not actionable; needs a human decision

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions