Skip to content

fix(install): ensure p-retry resolves for npm install -g from source - #1112

Merged
ericksoa merged 8 commits into
mainfrom
fix/p-retry-global-install
Mar 30, 2026
Merged

ericksoa merged 8 commits into
mainfrom
fix/p-retry-global-install

Conversation

@ericksoa

@ericksoa ericksoa commented Mar 30, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Bootstrap production deps in the prepare lifecycle script when node_modules/p-retry is missing — covers npm install -g . and npm link from a fresh clone
  • Add bundleDependencies for p-retry so tarball-based installs (npm pack, npm publish) physically bundle it

Root Cause

npm install -g . from a fresh clone creates a symlink (equivalent to npm link) and does not install dependencies — only added 1 package (the symlink itself). The binary then runs from the local directory where node_modules doesn't exist, so require('p-retry') fails with MODULE_NOT_FOUND.

The installer script (install.sh) was unaffected because it already runs npm install --ignore-scripts before npm link. This only broke the manual git clone && npm install -g . path.

Regression from #1051.

Test plan

  • npm test — 632 tests pass, no regressions
  • Fresh clone → npm install -g . → nemoclaw --help no longer crashes
  • Existing install.sh path unchanged (already runs npm install first)

Summary by CodeRabbit

  • Chores
    • Improved package prepare/install flow to more reliably install production dependencies before setup steps, reducing failures during installation.
    • Ensured a key retry dependency is bundled with releases so it’s included in distributed packages and works consistently for end users.

`npm install -g .` from a fresh clone creates a symlink (equivalent to
`npm link`) and does NOT install dependencies. This causes `require('p-retry')`
to fail at runtime since node_modules doesn't exist locally.

- Add dep bootstrap to `prepare` script: installs production deps if missing,
  which runs during `npm link` / `npm install -g .` but is a no-op during
  normal `npm install` (deps already present)
- Add `bundleDependencies` for tarball-based install paths (npm pack/publish)

Fixes regression from #1051.
@coderabbitai

coderabbitai Bot commented Mar 30, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f7ed5503-df8f-478f-b796-30b612ab06db

📥 Commits

Reviewing files that changed from the base of the PR and between d5dad91 and 4955db8.

📒 Files selected for processing (1)
  • package.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • package.json

📝 Walkthrough

Walkthrough

Updated package.json: the prepare script now first attempts a production-only npm install (suppressing errors) before running the existing git-hook / prek install conditional flow; added bundleDependencies: ["p-retry"] to include p-retry in packaged output.

Changes

Cohort / File(s) Summary
Package Configuration
package.json
Prepends `npm install --omit=dev --ignore-scripts 2>/dev/null

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 I hopped in the scripts, gave install a try,

Bundled a retry so builds won't sigh,
Hooks still check in their careful dance,
A tiny change, a steadier chance,
🥕✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main fix: ensuring p-retry resolves for global npm installs from source, which matches the core intent of bootstrapping production dependencies in the prepare script.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/p-retry-global-install

Comment @coderabbitai help to get the list of available commands and usage tips.

@ericksoa ericksoa self-assigned this Mar 30, 2026
@ericksoa ericksoa added bug dependencies Pull requests that update a dependency file labels Mar 30, 2026
Comment thread package.json Outdated
"typecheck": "tsc -p jsconfig.json",
"typecheck:cli": "tsc -p tsconfig.cli.json",
"prepare": "if [ -d .git ]; then if command -v prek >/dev/null 2>&1; then prek install; elif [ -d node_modules/@j178/prek ]; then echo \"ERROR: prek package found but binary not in PATH\" && exit 1; else echo \"Skipping git hook setup (prek not installed)\"; fi; fi",
"prepare": "if [ ! -d node_modules/p-retry ]; then echo 'Installing production dependencies…' && npm install --omit=dev --ignore-scripts 2>/dev/null || true; fi && if [ -d .git ]; then if command -v prek >/dev/null 2>&1; then prek install; elif [ -d node_modules/@j178/prek ]; then echo \"ERROR: prek package found but binary not in PATH\" && exit 1; else echo \"Skipping git hook setup (prek not installed)\"; fi; fi",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why make this conditional on node_modules/p-retry and not always install the production deps?

ericksoa and others added 4 commits March 30, 2026 12:01
Address review feedback: remove conditional node_modules/p-retry check
and unconditionally run npm install --omit=dev --ignore-scripts. This is
a no-op when deps are already present and ensures they resolve in the
global install case.
@ericksoa
ericksoa merged commit 19978a3 into main Mar 30, 2026
9 checks passed
@cv
cv deleted the fix/p-retry-global-install branch March 30, 2026 21:58
quanticsoul4772 pushed a commit to quanticsoul4772/NemoClaw that referenced this pull request Mar 30, 2026
…VIDIA#1112)

* fix(install): ensure p-retry is available for npm install -g from source

`npm install -g .` from a fresh clone creates a symlink (equivalent to
`npm link`) and does NOT install dependencies. This causes `require('p-retry')`
to fail at runtime since node_modules doesn't exist locally.

- Add dep bootstrap to `prepare` script: installs production deps if missing,
  which runs during `npm link` / `npm install -g .` but is a no-op during
  normal `npm install` (deps already present)
- Add `bundleDependencies` for tarball-based install paths (npm pack/publish)

Fixes regression from NVIDIA#1051.

* fix(install): always install production deps in prepare script

Address review feedback: remove conditional node_modules/p-retry check
and unconditionally run npm install --omit=dev --ignore-scripts. This is
a no-op when deps are already present and ensures they resolve in the
global install case.

---------

Co-authored-by: Carlos Villela <cvillela@nvidia.com>
laitingsheng pushed a commit that referenced this pull request Apr 2, 2026
…1112)

* fix(install): ensure p-retry is available for npm install -g from source

`npm install -g .` from a fresh clone creates a symlink (equivalent to
`npm link`) and does NOT install dependencies. This causes `require('p-retry')`
to fail at runtime since node_modules doesn't exist locally.

- Add dep bootstrap to `prepare` script: installs production deps if missing,
  which runs during `npm link` / `npm install -g .` but is a no-op during
  normal `npm install` (deps already present)
- Add `bundleDependencies` for tarball-based install paths (npm pack/publish)

Fixes regression from #1051.

* fix(install): always install production deps in prepare script

Address review feedback: remove conditional node_modules/p-retry check
and unconditionally run npm install --omit=dev --ignore-scripts. This is
a no-op when deps are already present and ensures they resolve in the
global install case.

---------

Co-authored-by: Carlos Villela <cvillela@nvidia.com>
lakamsani pushed a commit to lakamsani/NemoClaw that referenced this pull request Apr 4, 2026
…VIDIA#1112)

* fix(install): ensure p-retry is available for npm install -g from source

`npm install -g .` from a fresh clone creates a symlink (equivalent to
`npm link`) and does NOT install dependencies. This causes `require('p-retry')`
to fail at runtime since node_modules doesn't exist locally.

- Add dep bootstrap to `prepare` script: installs production deps if missing,
  which runs during `npm link` / `npm install -g .` but is a no-op during
  normal `npm install` (deps already present)
- Add `bundleDependencies` for tarball-based install paths (npm pack/publish)

Fixes regression from NVIDIA#1051.

* fix(install): always install production deps in prepare script

Address review feedback: remove conditional node_modules/p-retry check
and unconditionally run npm install --omit=dev --ignore-scripts. This is
a no-op when deps are already present and ensures they resolve in the
global install case.

---------

Co-authored-by: Carlos Villela <cvillela@nvidia.com>
gemini2026 pushed a commit to gemini2026/NemoClaw that referenced this pull request Apr 14, 2026
…VIDIA#1112)

* fix(install): ensure p-retry is available for npm install -g from source

`npm install -g .` from a fresh clone creates a symlink (equivalent to
`npm link`) and does NOT install dependencies. This causes `require('p-retry')`
to fail at runtime since node_modules doesn't exist locally.

- Add dep bootstrap to `prepare` script: installs production deps if missing,
  which runs during `npm link` / `npm install -g .` but is a no-op during
  normal `npm install` (deps already present)
- Add `bundleDependencies` for tarball-based install paths (npm pack/publish)

Fixes regression from NVIDIA#1051.

* fix(install): always install production deps in prepare script

Address review feedback: remove conditional node_modules/p-retry check
and unconditionally run npm install --omit=dev --ignore-scripts. This is
a no-op when deps are already present and ensures they resolve in the
global install case.

---------

Co-authored-by: Carlos Villela <cvillela@nvidia.com>
@wscurran wscurran added bug-fix PR fixes a bug or regression chore Build, CI, dependency, or tooling maintenance and removed bug chore Build, CI, dependency, or tooling maintenance labels Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug-fix PR fixes a bug or regression dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants