Fix npm installation issues during setup

- Created reusable ensure_npm_packages function for consistency
- Fixed npm install being called in wrong directory during installation
- Added proper directory context preservation for npm operations
- Ensured package.json file is always copied to installation directory
- Added checks to prevent redundant npm installations
- Improved error handling and reporting for npm operations

🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-03-07 10:18:45 +00:00
parent 16c73bca70
commit 83222078d9
2 changed files with 50 additions and 11 deletions

View File

@@ -295,10 +295,8 @@ EOF
exit 1
}
# Install npm dependencies
log "INFO" "Updating npm dependencies..."
cd "$SCRIPT_DIR"
npm install || {
# Install npm dependencies using our common function
ensure_npm_packages "$INSTALL_DIR" || {
log "ERROR" "NPM installation failed"
exit 1
}
@@ -393,10 +391,8 @@ else
exit 1
}
# Step 6: Install npm dependencies
log "INFO" "Installing npm dependencies..."
cd "$SCRIPT_DIR"
npm install || {
# Step 6: Install npm dependencies using our common function
ensure_npm_packages "$INSTALL_DIR" || {
log "ERROR" "NPM installation failed"
exit 1
}