Skip to content

Commit 2180ce0

Browse files
anandgupta42claude
andauthored
fix: include nested node_modules in NODE_PATH for NAPI resolution (#576)
After `npm install -g`, `@altimateai/altimate-core` is installed as a dependency of `altimate-code` and lives at `<global_root>/altimate-code/node_modules/`, not at the global root. NODE_PATH must include both paths to handle npm's hoisted and nested layouts. This fixes the sole remaining Verdaccio sanity CI failure (Phase 1 and Phase 1b NAPI binding checks). Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent ddd7a6f commit 2180ce0

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

test/sanity/phases/verify-install-extended.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,8 @@ if ! command -v node >/dev/null 2>&1; then
281281
skip_test "NAPI module exports" "node not available"
282282
else
283283
NAPI_ROOT=$(npm root -g 2>/dev/null || echo "")
284-
NAPI_CHECK=$(NODE_PATH="$NAPI_ROOT:$HOME/.npm-global/lib/node_modules" node -e "
284+
NAPI_AC_NM="$NAPI_ROOT/altimate-code/node_modules"
285+
NAPI_CHECK=$(NODE_PATH="$NAPI_ROOT:$NAPI_AC_NM" node -e "
285286
try {
286287
const m = require('@altimateai/altimate-core');
287288
// Verify it exports something (not just an empty module)

test/sanity/phases/verify-install.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,11 @@ assert_file_exists "$HOME/.altimate/builtin/dbt-analyze/SKILL.md" "dbt-analyze s
3232
# After npm install -g, dependencies live under the global prefix's node_modules.
3333
# Node's require() doesn't search there by default — set NODE_PATH so the
3434
# NAPI module (and its platform-specific optional dep) can be found.
35+
# npm may hoist altimate-core to the global root OR nest it under
36+
# altimate-code/node_modules/ — include both paths.
3537
GLOBAL_NM=$(npm root -g 2>/dev/null || echo "")
36-
assert_exit_0 "altimate-core napi binding" env NODE_PATH="$GLOBAL_NM" node -e "require('@altimateai/altimate-core')"
38+
AC_NM="$GLOBAL_NM/altimate-code/node_modules"
39+
assert_exit_0 "altimate-core napi binding" env NODE_PATH="$GLOBAL_NM:$AC_NM" node -e "require('@altimateai/altimate-core')"
3740

3841
# 8. dbt CLI available
3942
if command -v dbt >/dev/null 2>&1; then
@@ -105,10 +108,11 @@ DRIVERS=(
105108
DRIVER_PASS=0
106109
DRIVER_FAIL=0
107110
DRIVER_NODE_PATH=$(npm root -g 2>/dev/null || echo "")
111+
DRIVER_AC_NM="$DRIVER_NODE_PATH/altimate-code/node_modules"
108112
for entry in "${DRIVERS[@]}"; do
109113
pkg="${entry%%:*}"
110114
label="${entry##*:}"
111-
if NODE_PATH="$DRIVER_NODE_PATH" node -e "require.resolve('$pkg')" 2>/dev/null; then
115+
if NODE_PATH="$DRIVER_NODE_PATH:$DRIVER_AC_NM" node -e "require.resolve('$pkg')" 2>/dev/null; then
112116
echo " PASS: $label driver resolvable ($pkg)"
113117
DRIVER_PASS=$((DRIVER_PASS + 1))
114118
else

0 commit comments

Comments
 (0)