Skip to content

Commit 968fb3c

Browse files
authored
feat: improve dependency installer robustness, add tests, and document npm TAR_ENTRY_ERROR (#26)
- installer: make Node installs idempotent (skip when node_modules is up-to-date) - add isDependenciesUpToDate helper - use cmd.exe /c on Windows to correctly invoke .cmd package managers - add non-interactive flags per package manager and set npm progress/log env vars - stream output unless JSON mode (suppress output when JSON) - installer: improve Python venv handling - create .venv when missing, run uv venv if required - use pip from venv to install requirements with non-interactive flags - use --no-progress / --disable-pip-version-check and other optimizations - clearer user-facing messages when not in JSON mode - installer: small fixes - RestoreDotnetProject: avoid setting Stdin to prevent interactive prompts - setupWithPoetry: improve success messaging - ensure child commands respect JSON output mode - cmd: display "Installing <path> (manager)" for each project when not in JSON mode - docs: add troubleshooting section for "npm TAR_ENTRY_ERROR" on Windows with causes and solutions (long paths, antivirus, pnpm, etc.) - tests: add comprehensive unit tests for core commands and service packages (core, env, logmanager, orchestrator) - misc: update ports.json timestamp and coverage mapping reorder
1 parent 820359f commit 968fb3c

File tree

9 files changed

+2636
-1795
lines changed

9 files changed

+2636
-1795
lines changed

cli/cov

Lines changed: 1094 additions & 1757 deletions
Large diffs are not rendered by default.

cli/docs/commands/deps.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,50 @@ services:
611611
project: ./src/web
612612
```
613613
614+
### Issue: npm TAR_ENTRY_ERROR on Windows
615+
616+
**Symptoms**:
617+
```
618+
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory
619+
```
620+
621+
**Causes**:
622+
1. **Windows path length limits** - Deeply nested `node_modules` can exceed the 260-character limit
623+
2. **File system interference** - Antivirus or security software blocking file access
624+
625+
**Solutions**:
626+
627+
**1. Enable Windows Long Path Support (Recommended)**:
628+
```powershell
629+
# Run PowerShell as Administrator
630+
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" `
631+
-Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force
632+
633+
# Restart your terminal or machine
634+
```
635+
636+
**2. Use a shorter project path**:
637+
```powershell
638+
# Instead of: C:\Users\username\Documents\Projects\my-long-project-name
639+
# Use: C:\p\myapp
640+
```
641+
642+
**3. Clear npm cache and retry**:
643+
```powershell
644+
npm cache clean --force
645+
Remove-Item -Recurse -Force node_modules
646+
azd app deps
647+
```
648+
649+
**4. Temporarily disable antivirus** during installation (if safe to do so)
650+
651+
**5. Switch to pnpm** (better Windows support):
652+
```bash
653+
npm install -g pnpm
654+
# pnpm uses symlinks and handles long paths better
655+
# Then delete package-lock.json and run azd app deps
656+
```
657+
614658
### Issue: Wrong package manager detected
615659

616660
**Cause**: Multiple lock files exist

cli/src/cmd/app/commands/core.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,16 @@ func (di *DependencyInstaller) installProject(projectType, dir, manager string,
334334
Dir: dir,
335335
Manager: manager,
336336
}
337+
338+
// Show which project we're installing
339+
if !output.IsJSON() {
340+
relDir := dir
341+
if rel, err := filepath.Rel(di.searchRoot, dir); err == nil && rel != "." {
342+
relDir = rel
343+
}
344+
output.Item("Installing %s (%s)", relDir, manager)
345+
}
346+
337347
if err := installFunc(); err != nil {
338348
if !output.IsJSON() {
339349
output.ItemWarning("Failed to install for %s: %v", dir, err)

0 commit comments

Comments
 (0)