Repository navigation
fix(install): ensure p-retry resolves for npm install -g from source - #1112
Conversation
`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.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughUpdated Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
| "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", |
There was a problem hiding this comment.
Why make this conditional on node_modules/p-retry and not always install the production deps?
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.
… fix/p-retry-global-install
…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>
…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>
…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>
…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>
Summary
preparelifecycle script whennode_modules/p-retryis missing — coversnpm install -g .andnpm linkfrom a fresh clonebundleDependenciesforp-retryso tarball-based installs (npm pack,npm publish) physically bundle itRoot Cause
npm install -g .from a fresh clone creates a symlink (equivalent tonpm link) and does not install dependencies — onlyadded 1 package(the symlink itself). The binary then runs from the local directory wherenode_modulesdoesn't exist, sorequire('p-retry')fails withMODULE_NOT_FOUND.The installer script (
install.sh) was unaffected because it already runsnpm install --ignore-scriptsbeforenpm link. This only broke the manualgit clone && npm install -g .path.Regression from #1051.
Test plan
npm test— 632 tests pass, no regressionsnpm install -g .→nemoclaw --helpno longer crashesinstall.shpath unchanged (already runsnpm installfirst)Summary by CodeRabbit