Skip to content

Commit 02f2870

Browse files
fix: fallback to yarn install when node_modules hard-linking fails
Agent-Logs-Url: https://github.com/MobilityData/mobilitydatabase-web/sessions/b94c36ed-c130-4c94-b685-7e7ba5ecd4c9 Co-authored-by: Alessandro100 <18631060+Alessandro100@users.noreply.github.com>
1 parent d4a1fba commit 02f2870

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

scripts/new-worktree.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,13 @@ done
3131
# Fall back to yarn install if node_modules doesn't exist in main repo
3232
if [ -d "$MAIN_REPO/node_modules" ]; then
3333
echo "📦 Hard-linking node_modules..."
34-
cp -rl "$MAIN_REPO/node_modules" "$WORKTREE_DIR/node_modules"
34+
if ! cp -rl "$MAIN_REPO/node_modules" "$WORKTREE_DIR/node_modules"; then
35+
echo "⚠️ Hard-linking node_modules failed, running yarn install..."
36+
(cd "$WORKTREE_DIR" && yarn install)
37+
fi
3538
else
3639
echo "📦 node_modules not found in main repo, running yarn install..."
37-
cd $WORKTREE_DIR && yarn install
40+
(cd "$WORKTREE_DIR" && yarn install)
3841
fi
3942

4043
# Open in VSCode
@@ -45,4 +48,4 @@ else
4548
fi
4649

4750
echo "✅ Worktree ready at $WORKTREE_DIR on branch $BRANCH"
48-
51+

0 commit comments

Comments
 (0)