Skip to content

fix: add --ignore-scripts to npm install to unblock installs - #505

Merged
liveaverage merged 1 commit into
mainfrom
fix/install-ignore-scripts-503
Mar 20, 2026
Merged

fix: add --ignore-scripts to npm install to unblock installs#505
liveaverage merged 1 commit into
mainfrom
fix/install-ignore-scripts-503

Conversation

@ericksoa

@ericksoa ericksoa commented Mar 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Pre-extract the openclaw dependency with system tar before npm install to bypass npm's broken tarball extraction
  • Change the GitHub install path from npm install -g git+... to clone → pre-extract → npm install --ignore-scripts && npm link
  • Add --ignore-scripts to all npm install calls to prevent @whiskeysockets/baileys postinstall crash
  • Update installer test stubs for the new install flow

Root Cause

The openclaw npm tarball (v2026.3.11) is missing directory entries for extensions/, skills/, and dist/plugin-sdk/config/. npm's tar extractor hard-fails with ENOENT because it doesn't create parent directories implicitly. System tar handles this correctly.

Fix

Pre-extract openclaw into node_modules/openclaw using system tar before npm install runs. npm sees the dependency is already satisfied and skips the broken tarball download entirely.

For the GitHub install path, the installer now:

  1. Clones the repo to ~/.nemoclaw/source
  2. Downloads the openclaw tarball via npm pack
  3. Extracts it with system tar (handles missing dir entries)
  4. Runs npm install --ignore-scripts && npm link

The pre-extraction is non-fatal — if it fails, the install continues and will succeed once the upstream tarball is fixed.

Test plan

  • npm test passes (167/167)
  • Docker clean room: node:22-bookworm container, install from branch, nemoclaw --help exits 0
  • Post-install smoke: nemoclaw --help prints full usage
  • All npm install calls have --ignore-scripts

Fixes #503

Summary by CodeRabbit

  • Chores
    • Refactored installation flow to use local cloning and dependency linking instead of global installation
    • Added pre-extraction step for openclaw dependency to improve installation reliability and determinism

@coderabbitai

coderabbitai Bot commented Mar 20, 2026

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The pull request introduces a pre_extract_openclaw() helper function that resolves the openclaw version from package.json, downloads the tarball via npm pack, and extracts it using system tar before installation. The installation flow is restructured to use clone-and-link instead of global npm install, with --ignore-scripts flags added throughout. Tests are updated to mock git operations and validate the new extraction behavior.

Changes

Cohort / File(s) Summary
Install Script Modifications
install.sh, scripts/install.sh
Added pre_extract_openclaw() helper that resolves openclaw version, downloads via npm pack, and extracts with system tar using --strip-components=1. Refactored installation flow to use --ignore-scripts throughout and replaced global npm install -g with clone-and-link approach via npm link for GitHub branch.
Test Updates
test/install-preflight.test.js
Updated mocks to capture git operations in git.log instead of npm in npm.log. Added mock git clone that creates test package.json files. Reworked fake npm/node executables: npm pack fails (intentional), npm install --ignore-scripts succeeds, npm link creates binaries per scenario. Updated assertions to verify git clone presence instead of npm install patterns.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 A tarball arrives with disorder in sight,
With parent dirs missing—a tar extraction plight,
But our helper extracts with system tar's care,
--strip-components strips what's not there,
Now npm install succeeds, scripts ignored with flair! 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically summarizes the primary change: adding --ignore-scripts to npm install calls to resolve installer blocking issues.
Linked Issues check ✅ Passed The PR fully implements the objectives from issue #503: pre-extracts openclaw with system tar to bypass npm's tarball extraction bug, adds --ignore-scripts to all npm install calls, changes GitHub install flow to clone+link instead of global install, and updates tests to reflect the new flow.
Out of Scope Changes check ✅ Passed All changes are scoped to the installer scripts and their tests; no out-of-scope modifications to core application code or unrelated functionality were introduced.

✏️ 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/install-ignore-scripts-503

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@test/install-preflight.test.js`:
- Around line 101-102: Tests currently only assert the GitHub URL in the install
command stub (the conditional using if [ "$1" = "install" ] && [ "$2" = "-g" ]
&& [[ "$*" == *"${GITHUB_INSTALL_URL}"* ]]) and so will pass even if
--ignore-scripts is missing; update the conditional and corresponding test
assertions to require the --ignore-scripts token as well (e.g., include an
additional check like [[ "$*" == *"--ignore-scripts"* ]]) and tighten the
assertions at the other referenced locations (lines around the same install stub
occurrences) so each stub/expectation verifies both the GitHub URL and the
--ignore-scripts flag is present.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f4795b99-8e75-4f0d-9bb0-c12ebca5d823

📥 Commits

Reviewing files that changed from the base of the PR and between 3aaef13 and 4cf9344.

📒 Files selected for processing (4)
  • .gitignore
  • install.sh
  • scripts/install.sh
  • test/install-preflight.test.js

Comment thread test/install-preflight.test.js Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
install.sh (1)

265-267: Consider adding minimal validation before npm link.

Using || true is necessary to tolerate postinstall failures per the PR objective, but it also masks complete install failures (e.g., network errors, registry unavailable). If npm install fails entirely, npm link on line 267 may behave unexpectedly.

Consider checking that node_modules/ exists before proceeding:

🛡️ Proposed validation
     npm install --ignore-scripts || true
+    if [[ ! -d "$(pwd)/node_modules" ]]; then
+      error "npm install failed — node_modules not created"
+    fi
     repair_openclaw_tarball "$(pwd)/node_modules/openclaw"
     npm link
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@install.sh` around lines 265 - 267, The script currently runs "npm install
--ignore-scripts || true" which masks complete install failures and then
proceeds to call repair_openclaw_tarball and "npm link"; add a minimal
validation after the install to ensure node_modules exists and contains expected
packages before running repair_openclaw_tarball or npm link: check for the
presence of the node_modules directory and the openclaw package (used by
repair_openclaw_tarball) and abort with an error message (non-zero exit) or skip
npm link if validation fails; update the install.sh flow around the npm install,
repair_openclaw_tarball, and npm link calls to gate those steps on this
validation.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@install.sh`:
- Around line 265-267: The script currently runs "npm install --ignore-scripts
|| true" which masks complete install failures and then proceeds to call
repair_openclaw_tarball and "npm link"; add a minimal validation after the
install to ensure node_modules exists and contains expected packages before
running repair_openclaw_tarball or npm link: check for the presence of the
node_modules directory and the openclaw package (used by
repair_openclaw_tarball) and abort with an error message (non-zero exit) or skip
npm link if validation fails; update the install.sh flow around the npm install,
repair_openclaw_tarball, and npm link calls to gate those steps on this
validation.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 390ce1a7-023b-4942-8ded-8ffd395a3735

📥 Commits

Reviewing files that changed from the base of the PR and between 4cf9344 and 21f52f7.

📒 Files selected for processing (2)
  • install.sh
  • scripts/install.sh
🚧 Files skipped from review as they are similar to previous changes (1)
  • scripts/install.sh

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
install.sh (1)

239-257: Consider trap-based cleanup for the temporary directory.

If tar xzf (line 245) or mkdir -p (line 244) fails, set -e causes an immediate exit, leaving $tmpdir behind. While minor (it's just a temp file), a trap ensures cleanup in all exit paths.

♻️ Optional: trap-based cleanup
   local tmpdir
   tmpdir="$(mktemp -d)"
+  trap 'rm -rf "$tmpdir"' RETURN
   if npm pack "openclaw@${openclaw_version}" --pack-destination "$tmpdir" > /dev/null 2>&1; then
-    local tgz="$tmpdir/openclaw-${openclaw_version}.tgz"
-    if [[ -f "$tgz" ]]; then
+    local tgz
+    tgz="$(find "$tmpdir" -maxdepth 1 -name 'openclaw-*.tgz' -print -quit)"
+    if [[ -n "$tgz" && -f "$tgz" ]]; then
       mkdir -p "${install_dir}/node_modules/openclaw"
       tar xzf "$tgz" -C "${install_dir}/node_modules/openclaw" --strip-components=1
       info "openclaw pre-extracted successfully"
     else
       warn "npm pack succeeded but tarball not found"
-      rm -rf "$tmpdir"
       return 1
     fi
   else
     warn "Failed to download openclaw tarball"
-    rm -rf "$tmpdir"
     return 1
   fi
-  rm -rf "$tmpdir"
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@install.sh` around lines 239 - 257, Create a trap to always remove the
temporary directory after tmpdir is created so failures in mkdir -p, tar xzf,
npm pack, or any set -e exits don't leak it; specifically, immediately after
tmpdir="$(mktemp -d)" set a trap like "trap 'rm -rf \"$tmpdir\"' EXIT" (and
optionally clear the trap after the final rm -rf), then keep the existing npm
pack, mkdir -p, and tar xzf logic unchanged so tmpdir is cleaned on any exit
path.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@install.sh`:
- Around line 241-251: The current install.sh block builds a tarball path using
openclaw_version which may be a semver range, causing tgz lookup to fail; update
the logic in the npm pack handling (the block using variables tmpdir,
openclaw_version, tgz, and install_dir/node_modules/openclaw) to locate the
produced tarball by searching tmpdir (e.g., using a glob or find for
openclaw-*.tgz) instead of constructing openclaw-${openclaw_version}.tgz, then
set tgz to the found file and proceed with mkdir -p and tar extraction as
before, handling the case where no match is found by issuing the warn, cleaning
tmpdir and returning 1.

---

Nitpick comments:
In `@install.sh`:
- Around line 239-257: Create a trap to always remove the temporary directory
after tmpdir is created so failures in mkdir -p, tar xzf, npm pack, or any set
-e exits don't leak it; specifically, immediately after tmpdir="$(mktemp -d)"
set a trap like "trap 'rm -rf \"$tmpdir\"' EXIT" (and optionally clear the trap
after the final rm -rf), then keep the existing npm pack, mkdir -p, and tar xzf
logic unchanged so tmpdir is cleaned on any exit path.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: df595090-a475-46e0-9cb6-088e163dfaff

📥 Commits

Reviewing files that changed from the base of the PR and between 21f52f7 and 82990d2.

📒 Files selected for processing (3)
  • install.sh
  • scripts/install.sh
  • test/install-preflight.test.js
🚧 Files skipped from review as they are similar to previous changes (2)
  • test/install-preflight.test.js
  • scripts/install.sh

Comment thread install.sh

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@install.sh`:
- Around line 245-247: The extraction block that uses mkdir, tar and then calls
info "openclaw pre-extracted successfully" must explicitly handle tar failures
instead of relying on set -e; check the exit status of the tar command (invoked
with tgz and install_dir/node_modules/openclaw) immediately after it and on
non-zero exit call warn with a clear message and return a non-zero status (or
exit) so the success info() is not printed; update the function containing this
block to use an explicit conditional around tar (and/or capture its exit code)
so failures are propagated correctly.
- Around line 264-277: The install script's npm link calls in install_nemoclaw
(the blocks running "npm install --ignore-scripts" and "npm link" in both the
local source and GitHub clone branches) assume a writable global npm prefix and
can fail with EACCES; before running npm install/link, either call
ensure_nvm_loaded at the start of install_nemoclaw so the user nvm/node is
active, or add a check that the current npm prefix is writable and if not set a
user-writable prefix (or configure npm to use a local prefix) so npm link
targets a writable location; update both occurrences where pre_extract_openclaw
is followed by "npm install --ignore-scripts" and "npm link" (the subshell "(cd
\"$nemoclaw_src\" && npm install --ignore-scripts && npm link)" and the earlier
branch) to perform this check or load nvm.

In `@scripts/install.sh`:
- Around line 406-411: The npm link call can fail for non-root users because the
system npm prefix may be unwritable; before running (cd "$NEMOCLAW_SRC" && npm
install --ignore-scripts && npm link) update npm to use a user-writable prefix
(e.g., run npm config set prefix "${HOME}/.npm-global") or invoke npm link with
an explicit user prefix (npm link --prefix "${HOME}/.npm-global") so the
NEMOCLAW_SRC install and the npm link step succeed for unprivileged users; apply
this change around the block that sets and uses NEMOCLAW_SRC and ensure any
created prefix directory exists and is added to PATH for subsequent commands.
- Around line 384-386: The tar extraction step using tar xzf "$tgz" -C
"${install_dir}/node_modules/openclaw" --strip-components=1 must be guarded so
failures are detected and cause the function/script to fail instead of logging
success; replace the current unguarded sequence (mkdir -p
"${install_dir}/node_modules/openclaw"; tar xzf "$tgz" ...; info "openclaw
pre-extracted successfully") with an explicit check that the tar command
succeeded (e.g. if ! tar ...; then call the error path or return/exit non-zero),
and only call info "openclaw pre-extracted successfully" after verifying tar
returned success; reference the tar invocation and the info call when applying
the change and ensure the same behavior integrates with the existing || warning
handler later.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ee3424d0-a993-40cb-a6bf-9d2ddb49bce5

📥 Commits

Reviewing files that changed from the base of the PR and between 82990d2 and d2dd232.

📒 Files selected for processing (3)
  • install.sh
  • scripts/install.sh
  • test/install-preflight.test.js
🚧 Files skipped from review as they are similar to previous changes (1)
  • test/install-preflight.test.js

Comment thread install.sh Outdated
Comment thread install.sh Outdated
Comment on lines +264 to +277
pre_extract_openclaw "$(pwd)" || warn "Pre-extraction failed — npm install may fail if openclaw tarball is broken"
npm install --ignore-scripts
npm link
else
info "Installing NemoClaw from GitHub…"
# Revert once https://github.com/NVIDIA/NemoClaw/issues/71 is complete and the package is published
npm install -g git+https://github.com/NVIDIA/NemoClaw.git
# Clone first so we can pre-extract openclaw before npm install (GH-503).
# npm install -g git+https://... does this internally but we can't hook
# into its extraction pipeline, so we do it ourselves.
local nemoclaw_src="${HOME}/.nemoclaw/source"
rm -rf "$nemoclaw_src"
mkdir -p "$(dirname "$nemoclaw_src")"
git clone --depth 1 https://github.com/NVIDIA/NemoClaw.git "$nemoclaw_src"
pre_extract_openclaw "$nemoclaw_src" || warn "Pre-extraction failed — npm install may fail if openclaw tarball is broken"
(cd "$nemoclaw_src" && npm install --ignore-scripts && npm link)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# First, let's understand the structure and find the install.sh file
git ls-files | grep install.sh | head -20

Repository: NVIDIA/NemoClaw

Length of output: 132


🏁 Script executed:

# Read the install.sh file to understand the context around lines 264-277
wc -l install.sh

Repository: NVIDIA/NemoClaw

Length of output: 73


🏁 Script executed:

# Get the relevant section and context
head -n 280 install.sh | tail -n 100

Repository: NVIDIA/NemoClaw

Length of output: 3944


🏁 Script executed:

# Search for any npm prefix related checks or configurations in the entire script
rg -n "npm prefix|npm config|writable|EACCES|npm link" install.sh

Repository: NVIDIA/NemoClaw

Length of output: 341


🏁 Script executed:

# Check if there are any npm prefix-related configurations elsewhere in the script
rg -n "HOME.*npm|\.npmrc|npm_config" install.sh

Repository: NVIDIA/NemoClaw

Length of output: 41


🏁 Script executed:

# Let's see how npm_bin is being used in the script around those lines
sed -n '50,70p' install.sh

Repository: NVIDIA/NemoClaw

Length of output: 653


🏁 Script executed:

# Check the usage of npm_bin variable throughout the script
rg -n "npm_bin" install.sh -A 2 -B 2

Repository: NVIDIA/NemoClaw

Length of output: 1493


🏁 Script executed:

# Let's understand the full context of the install_nemoclaw function
sed -n '230,290p' install.sh

Repository: NVIDIA/NemoClaw

Length of output: 2499


🏁 Script executed:

# Check if there's any documentation about npm link behavior and EACCES errors
# Also check what npm requires for link to work
web_search
npm link EACCES permission denied global prefix

Repository: NVIDIA/NemoClaw

Length of output: 620


🏁 Script executed:

# Let me look at the full install_nemoclaw function and what happens after npm link
sed -n '245,310p' install.sh

Repository: NVIDIA/NemoClaw

Length of output: 2482


🏁 Script executed:

# Check if there are any npm prefix or config settings in .npmrc or elsewhere
find . -name ".npmrc" -o -name ".npm*" 2>/dev/null | head -20

Repository: NVIDIA/NemoClaw

Length of output: 41


🏁 Script executed:

# Let's understand npm link behavior by checking npm documentation expectations
# and see if there's any use of npm config set prefix in the script
rg -n "npm config set|npm prefix" install.sh

Repository: NVIDIA/NemoClaw

Length of output: 41


🏁 Script executed:

# Check if there's environment variable setup for npm (like npm_config_prefix)
rg -n "npm_config|NPM_" install.sh

Repository: NVIDIA/NemoClaw

Length of output: 307


🏁 Script executed:

# Let's see if the script checks for write permissions anywhere
rg -n "test -w|writable|permission" install.sh

Repository: NVIDIA/NemoClaw

Length of output: 41


🏁 Script executed:

# Let's check if nvm is being set up in the script and how it affects npm prefix
rg -n "nvm|NVM" install.sh -B 2 -A 2

Repository: NVIDIA/NemoClaw

Length of output: 2164


🏁 Script executed:

# Check the beginning of the script to see overall setup and flow
head -n 100 install.sh

Repository: NVIDIA/NemoClaw

Length of output: 3347


🏁 Script executed:

# Look for any npm prefix configuration or checks before npm link is called
sed -n '1,280p' install.sh | grep -n "npm\|prefix\|nvm"

Repository: NVIDIA/NemoClaw

Length of output: 3453


🏁 Script executed:

# Check if ensure_nvm_loaded is called before npm install and npm link
sed -n '260,280p' install.sh

Repository: NVIDIA/NemoClaw

Length of output: 1105


🏁 Script executed:

# Check the main entry point to see if ensure_nvm_loaded is called at script start
sed -n '360,401p' install.sh

Repository: NVIDIA/NemoClaw

Length of output: 1101


🏁 Script executed:

# Look for the main function and how install_nemoclaw is called
rg -n "main\|install_nemoclaw" install.sh | head -30

Repository: NVIDIA/NemoClaw

Length of output: 41


🏁 Script executed:

# Let's check if there's any explicit npm prefix configuration or checks
# Also check what happens with system npm vs nvm npm
sed -n '85,145p' install.sh

Repository: NVIDIA/NemoClaw

Length of output: 2541


🏁 Script executed:

# Check if there's any use of npm config set to configure prefix
rg -n "npm config set" install.sh

Repository: NVIDIA/NemoClaw

Length of output: 41


🏁 Script executed:

# Let's understand the actual risk: check if npm prefix is guaranteed to be writable
# by examining what happens if user has system npm on PATH
rg -n "command -v npm\|which npm" install.sh

Repository: NVIDIA/NemoClaw

Length of output: 41


🏁 Script executed:

# Verify the flow: does ensure_nvm_loaded get called before install_nemoclaw runs?
# And does it GUARANTEE nvm npm is used (not system npm)?
python3 << 'EOF'
# Parse the script flow to understand execution order
script_flow = [
    "main() starts",
    "  install_nodejs() - calls ensure_nvm_loaded at end",
    "  ensure_supported_runtime() - uses npm from PATH (which one?)",
    "  install_nemoclaw() - calls npm install and npm link (which npm?)",
    "  verify_nemoclaw() - calls ensure_nemoclaw_shim which uses npm config get prefix",
    "  refresh_path() - calls ensure_nvm_loaded and adds npm bin to PATH",
]

for step in script_flow:
    print(step)

print("\nCRITICAL ISSUE:")
print("- ensure_nvm_loaded() is called AFTER npm link in refresh_path()")
print("- Between install_nodejs() and install_nemoclaw(), npm command is ambiguous")
print("- If system npm is first on PATH, npm link targets system prefix (not writable)")
print("- Script validates versions but doesn't check npm prefix writability")
EOF

Repository: NVIDIA/NemoClaw

Length of output: 711


Ensure npm link targets a writable prefix or explicitly load nvm before installation.

Both npm link calls at lines 266 and 277 assume the npm prefix is writable. Users with pre-existing system npm on PATH will hit EACCES errors since system npm prefixes (e.g., /usr/local) are not user-writable. Add ensure_nvm_loaded to install_nemoclaw() before npm install, or add a check that the npm prefix is writable and configure npm accordingly.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@install.sh` around lines 264 - 277, The install script's npm link calls in
install_nemoclaw (the blocks running "npm install --ignore-scripts" and "npm
link" in both the local source and GitHub clone branches) assume a writable
global npm prefix and can fail with EACCES; before running npm install/link,
either call ensure_nvm_loaded at the start of install_nemoclaw so the user
nvm/node is active, or add a check that the current npm prefix is writable and
if not set a user-writable prefix (or configure npm to use a local prefix) so
npm link targets a writable location; update both occurrences where
pre_extract_openclaw is followed by "npm install --ignore-scripts" and "npm
link" (the subshell "(cd \"$nemoclaw_src\" && npm install --ignore-scripts &&
npm link)" and the earlier branch) to perform this check or load nvm.

Comment thread scripts/install.sh Outdated
Comment thread scripts/install.sh Outdated
@ericksoa
ericksoa force-pushed the fix/install-ignore-scripts-503 branch 2 times, most recently from 0fd8b9b to f1c4d3d Compare March 20, 2026 20:40
@ericksoa

Copy link
Copy Markdown
Contributor Author

Running a full local E2E test pass on the latest force-push (rebased on current main, single clean commit). Test matrix:

Test Description
1. Unit tests 167/167 pass
2. Docker install.sh local source path Installs from repo checkout
3. Docker install.sh GitHub clone path The broken path — installs from /tmp (no package.json), triggers clone → pre-extract → build → link
4. Docker scripts/install.sh curl path The curl | bash path real users hit
5. Post-install smoke nemoclaw help, list, onboard --non-interactive
6. dist/ built not committed Confirms PR #473 dist removal is intact and build step compensates
7. grep sanity checks --ignore-scripts everywhere, sudo npm link for nodesource, find-based tarball lookup, guarded tar extraction
8. No .gitignore pollution Only intended files changed

Will post results shortly.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (2)
scripts/install.sh (2)

384-386: ⚠️ Potential issue | 🟠 Major

Handle tar failures explicitly.

Because pre_extract_openclaw is invoked via ... || warn on Line 410, Bash will not stop on a failing tar on Line 385. That lets Line 386 log success and return 0, so the fallback warning never runs.

🔧 Suggested guard
     if [ -n "$tgz" ] && [ -f "$tgz" ]; then
-      mkdir -p "${install_dir}/node_modules/openclaw"
-      tar xzf "$tgz" -C "${install_dir}/node_modules/openclaw" --strip-components=1
-      info "openclaw pre-extracted successfully"
+      rm -rf "${install_dir}/node_modules/openclaw"
+      if mkdir -p "${install_dir}/node_modules/openclaw" \
+        && tar xzf "$tgz" -C "${install_dir}/node_modules/openclaw" --strip-components=1
+      then
+        info "openclaw pre-extracted successfully"
+      else
+        warn "Failed to extract openclaw tarball"
+        rm -rf "${install_dir}/node_modules/openclaw"
+        rm -rf "$tmpdir"
+        return 1
+      fi
     else

Also applies to: 410-410

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/install.sh` around lines 384 - 386, The tar extraction's exit status
is not checked, so the script always logs success; update the
pre_extract_openclaw implementation to test the tar command (the tar xzf "$tgz"
... invocation) and bail or propagate failure before printing info "openclaw
pre-extracted successfully" — e.g. if tar fails, call warn/error and return
non-zero (so callers using "pre_extract_openclaw || warn" get the fallback), or
explicitly check $? and handle the error path instead of unconditionally logging
success.

411-411: ⚠️ Potential issue | 🔴 Critical

npm link still assumes a writable global prefix.

On the default Linux/system-npm path, Line 411 writes into npm’s global prefix, which is typically root-owned. For unprivileged users that turns this step into an EACCES install blocker.

🔧 Suggested direction
+NEMOCLAW_NPM_PREFIX="${HOME}/.nemoclaw/npm-global"
+mkdir -p "$NEMOCLAW_NPM_PREFIX"
 ...
-(cd "$NEMOCLAW_SRC" && npm install --ignore-scripts && cd nemoclaw && npm install --ignore-scripts && npm run build && cd .. && npm link)
+(cd "$NEMOCLAW_SRC" && npm install --ignore-scripts && cd nemoclaw && npm install --ignore-scripts && npm run build && cd .. && npm link --prefix "$NEMOCLAW_NPM_PREFIX")
+export PATH="$NEMOCLAW_NPM_PREFIX/bin:$PATH"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/install.sh` at line 411, The script currently runs npm link from
within "$NEMOCLAW_SRC" which writes into npm’s global prefix (root-owned) and
fails for unprivileged users; change the final step that calls npm link so it
writes to a user-writable prefix instead (for example use npm link --prefix
"$HOME/.npm-global" after ensuring that directory exists and is configured, or
use npm install --global --prefix "$HOME/.npm-global" as an alternative). Update
the call that follows the build (the npm link invocation in the command sequence
inside the subshell for NEMOCLAW_SRC) to use a user-writable prefix variable
(create the directory if needed) so the operation no longer requires root-owned
global write access.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@scripts/install.sh`:
- Around line 406-410: Don't remove the existing NEMOCLAW_SRC until the new
source is fully prepared; instead clone to a temporary path (e.g.,
"${NEMOCLAW_SRC}.tmp" or tmpdir), run pre_extract_openclaw and any npm
build/link steps against that temp clone, and only on success atomically replace
the old NEMOCLAW_SRC (rm -rf old then mv temp -> NEMOCLAW_SRC). Update the
operations that reference NEMOCLAW_SRC (the git clone, pre_extract_openclaw
invocation, and subsequent npm install/build/link steps) to use the temp path
and perform cleanup of the temp on failure to avoid leaving the system without
the original installation.

---

Duplicate comments:
In `@scripts/install.sh`:
- Around line 384-386: The tar extraction's exit status is not checked, so the
script always logs success; update the pre_extract_openclaw implementation to
test the tar command (the tar xzf "$tgz" ... invocation) and bail or propagate
failure before printing info "openclaw pre-extracted successfully" — e.g. if tar
fails, call warn/error and return non-zero (so callers using
"pre_extract_openclaw || warn" get the fallback), or explicitly check $? and
handle the error path instead of unconditionally logging success.
- Line 411: The script currently runs npm link from within "$NEMOCLAW_SRC" which
writes into npm’s global prefix (root-owned) and fails for unprivileged users;
change the final step that calls npm link so it writes to a user-writable prefix
instead (for example use npm link --prefix "$HOME/.npm-global" after ensuring
that directory exists and is configured, or use npm install --global --prefix
"$HOME/.npm-global" as an alternative). Update the call that follows the build
(the npm link invocation in the command sequence inside the subshell for
NEMOCLAW_SRC) to use a user-writable prefix variable (create the directory if
needed) so the operation no longer requires root-owned global write access.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 259ae252-7d75-4064-a7a1-49c187467e69

📥 Commits

Reviewing files that changed from the base of the PR and between d2dd232 and 0fd8b9b.

📒 Files selected for processing (3)
  • install.sh
  • scripts/install.sh
  • test/install-preflight.test.js
🚧 Files skipped from review as they are similar to previous changes (2)
  • install.sh
  • test/install-preflight.test.js

Comment thread scripts/install.sh
Comment on lines +406 to +410
NEMOCLAW_SRC="${HOME}/.nemoclaw/source"
rm -rf "$NEMOCLAW_SRC"
mkdir -p "$(dirname "$NEMOCLAW_SRC")"
git clone --depth 1 https://github.com/NVIDIA/NemoClaw.git "$NEMOCLAW_SRC"
pre_extract_openclaw "$NEMOCLAW_SRC" || warn "Pre-extraction failed — npm install may fail if openclaw tarball is broken"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# First, let's find and read the scripts/install.sh file
git ls-files | grep -E "scripts/install\.sh"

Repository: NVIDIA/NemoClaw

Length of output: 77


🏁 Script executed:

# Read the relevant lines around 406-410
wc -l scripts/install.sh

Repository: NVIDIA/NemoClaw

Length of output: 81


🏁 Script executed:

# Get the context around lines 406-410
sed -n '400,420p' scripts/install.sh

Repository: NVIDIA/NemoClaw

Length of output: 989


🏁 Script executed:

# Check the entire section dealing with nemoclaw to understand the broader context
rg -n "NEMOCLAW_SRC" scripts/install.sh -A 5 -B 5

Repository: NVIDIA/NemoClaw

Length of output: 1168


🏁 Script executed:

# Search for npm link usage in the script
rg -n "npm link" scripts/install.sh -A 2 -B 2

Repository: NVIDIA/NemoClaw

Length of output: 703


🏁 Script executed:

# Check for error handling context - is set -e enabled?
head -50 scripts/install.sh | grep -E "set -e|set -o|trap"

Repository: NVIDIA/NemoClaw

Length of output: 76


🏁 Script executed:

# Look for pre_extract_openclaw function definition
rg -n "pre_extract_openclaw" scripts/install.sh -B 30 | head -60

Repository: NVIDIA/NemoClaw

Length of output: 2125


🏁 Script executed:

# Check if there's any error checking around npm operations
sed -n '410,430p' scripts/install.sh

Repository: NVIDIA/NemoClaw

Length of output: 997


Delete the directory only after the new installation is complete, not before.

With set -e active, if git clone fails at line 415, the old nemoclaw installation is already deleted and the script exits—leaving the system in a broken state. Even if clone succeeds, transient failures during npm install, npm run build, or npm link will cause the script to exit with the old installation already removed.

🔧 Suggested approach
 NEMOCLAW_SRC="${HOME}/.nemoclaw/source"
-rm -rf "$NEMOCLAW_SRC"
 mkdir -p "$(dirname "$NEMOCLAW_SRC")"
-git clone --depth 1 https://github.com/NVIDIA/NemoClaw.git "$NEMOCLAW_SRC"
-pre_extract_openclaw "$NEMOCLAW_SRC" || warn "Pre-extraction failed — npm install may fail if openclaw tarball is broken"
-(cd "$NEMOCLAW_SRC" && npm install --ignore-scripts && cd nemoclaw && npm install --ignore-scripts && npm run build && cd .. && npm link)
+NEMOCLAW_STAGING="$(mktemp -d "${HOME}/.nemoclaw/source.XXXXXX")"
+git clone --depth 1 https://github.com/NVIDIA/NemoClaw.git "$NEMOCLAW_STAGING"
+pre_extract_openclaw "$NEMOCLAW_STAGING" || warn "Pre-extraction failed — npm install may fail if openclaw tarball is broken"
+(cd "$NEMOCLAW_STAGING" && npm install --ignore-scripts && cd nemoclaw && npm install --ignore-scripts && npm run build)
+rm -rf "$NEMOCLAW_SRC"
+mv "$NEMOCLAW_STAGING" "$NEMOCLAW_SRC"
+(cd "$NEMOCLAW_SRC" && npm link)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/install.sh` around lines 406 - 410, Don't remove the existing
NEMOCLAW_SRC until the new source is fully prepared; instead clone to a
temporary path (e.g., "${NEMOCLAW_SRC}.tmp" or tmpdir), run pre_extract_openclaw
and any npm build/link steps against that temp clone, and only on success
atomically replace the old NEMOCLAW_SRC (rm -rf old then mv temp ->
NEMOCLAW_SRC). Update the operations that reference NEMOCLAW_SRC (the git clone,
pre_extract_openclaw invocation, and subsequent npm install/build/link steps) to
use the temp path and perform cleanup of the temp on failure to avoid leaving
the system without the original installation.

@antoniomtz antoniomtz left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Installation worked for me

@liveaverage

Copy link
Copy Markdown
Contributor

LGTM and passed on local and GH install paths

The openclaw npm tarball is missing directory entries for extensions/,
skills/, and dist/plugin-sdk/config/. npm's tar extractor hard-fails
on these, and the @whiskeysockets/baileys postinstall then crashes
with `spawn sh ENOENT`, killing the entire install.

Fix: pre-extract openclaw into node_modules using system tar (which
handles missing directory entries) BEFORE npm install, so npm sees
the dependency is already satisfied and skips the broken download.

Both install scripts now clone the repo, pre-extract openclaw, then
run `npm install --ignore-scripts` + build + `npm link` instead of
the previous `npm install -g git+url` which we can't hook into.

The pre-extraction is non-fatal — if it fails, the install continues
and will succeed once the upstream tarball is fixed.

Fixes #503
@ericksoa
ericksoa force-pushed the fix/install-ignore-scripts-503 branch from f1c4d3d to 1b9b4fb Compare March 20, 2026 20:56
@liveaverage
liveaverage self-requested a review March 20, 2026 21:10

@liveaverage liveaverage left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ran e2e with success (as normal user + root, albeit with sudo present) using local repo install and GH install

@liveaverage
liveaverage merged commit ab5048a into main Mar 20, 2026
3 checks passed
@wscurran wscurran added NemoClaw CLI enhancement New capability or improvement request labels Mar 20, 2026
Ryuketsukami pushed a commit to Ryuketsukami/NemoClaw that referenced this pull request Mar 24, 2026
…#503) (NVIDIA#505)

The openclaw npm tarball is missing directory entries for extensions/,
skills/, and dist/plugin-sdk/config/. npm's tar extractor hard-fails
on these, and the @whiskeysockets/baileys postinstall then crashes
with `spawn sh ENOENT`, killing the entire install.

Fix: pre-extract openclaw into node_modules using system tar (which
handles missing directory entries) BEFORE npm install, so npm sees
the dependency is already satisfied and skips the broken download.

Both install scripts now clone the repo, pre-extract openclaw, then
run `npm install --ignore-scripts` + build + `npm link` instead of
the previous `npm install -g git+url` which we can't hook into.

The pre-extraction is non-fatal — if it fails, the install continues
and will succeed once the upstream tarball is fixed.

Fixes NVIDIA#503
jessesanford pushed a commit to jessesanford/NemoClaw that referenced this pull request Mar 24, 2026
…#503) (NVIDIA#505)

The openclaw npm tarball is missing directory entries for extensions/,
skills/, and dist/plugin-sdk/config/. npm's tar extractor hard-fails
on these, and the @whiskeysockets/baileys postinstall then crashes
with `spawn sh ENOENT`, killing the entire install.

Fix: pre-extract openclaw into node_modules using system tar (which
handles missing directory entries) BEFORE npm install, so npm sees
the dependency is already satisfied and skips the broken download.

Both install scripts now clone the repo, pre-extract openclaw, then
run `npm install --ignore-scripts` + build + `npm link` instead of
the previous `npm install -g git+url` which we can't hook into.

The pre-extraction is non-fatal — if it fails, the install continues
and will succeed once the upstream tarball is fixed.

Fixes NVIDIA#503
@wscurran wscurran added area: cli Command line interface, flags, terminal UX, or output feature PR adds or expands user-visible functionality and removed NemoClaw CLI enhancement New capability or improvement request labels Jun 3, 2026
@cv
cv deleted the fix/install-ignore-scripts-503 branch June 28, 2026 00:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: cli Command line interface, flags, terminal UX, or output feature PR adds or expands user-visible functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

npm install -g fails with TAR_ENTRY_ERROR — missing parent directories in openclaw tarball

4 participants