Fix Windows package.json error in setup scripts
- Add automatic PlatformIO package cleanup and reinstall - Handle corrupted framework downloads on Windows - Improve error handling and user guidance
This commit is contained in:
parent
acc1334daf
commit
4850d5b257
@ -21,7 +21,30 @@ if not exist "%FRAMEWORK_ZEPHYR%" (
|
|||||||
)
|
)
|
||||||
|
|
||||||
if not exist "%LORAMAC_NODE%" (
|
if not exist "%LORAMAC_NODE%" (
|
||||||
echo Error: LoRaMAC-Node not found at %LORAMAC_NODE%
|
echo LoRaMAC-Node not found, need to fix PlatformIO packages first...
|
||||||
|
echo Cleaning and reinstalling PlatformIO packages...
|
||||||
|
|
||||||
|
echo Removing corrupted packages...
|
||||||
|
rmdir /s /q "%PIO_PACKAGES%" 2>nul
|
||||||
|
|
||||||
|
echo Updating PlatformIO core...
|
||||||
|
pio update
|
||||||
|
|
||||||
|
echo Running initial build to download fresh packages...
|
||||||
|
pio run
|
||||||
|
if %errorlevel% neq 0 (
|
||||||
|
echo [31mError: Build failed after package cleanup[0m
|
||||||
|
echo [33mTry running: pio platform install ststm32[0m
|
||||||
|
pause
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
echo [32m✓ Framework modules initialized[0m
|
||||||
|
)
|
||||||
|
|
||||||
|
REM Double-check after potential build
|
||||||
|
if not exist "%LORAMAC_NODE%" (
|
||||||
|
echo Error: LoRaMAC-Node still not found at %LORAMAC_NODE%
|
||||||
|
echo Please check PlatformIO installation and project configuration
|
||||||
pause
|
pause
|
||||||
exit /b 1
|
exit /b 1
|
||||||
)
|
)
|
||||||
|
|||||||
@ -20,7 +20,37 @@ if (-not (Test-Path $FRAMEWORK_ZEPHYR)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (-not (Test-Path $LORAMAC_NODE)) {
|
if (-not (Test-Path $LORAMAC_NODE)) {
|
||||||
Write-Host "Error: LoRaMAC-Node not found at $LORAMAC_NODE" -ForegroundColor Red
|
Write-Host "LoRaMAC-Node not found, need to fix PlatformIO packages first..." -ForegroundColor Yellow
|
||||||
|
Write-Host "Cleaning and reinstalling PlatformIO packages..."
|
||||||
|
|
||||||
|
Write-Host "Removing corrupted packages..."
|
||||||
|
if (Test-Path $PIO_PACKAGES) {
|
||||||
|
Remove-Item $PIO_PACKAGES -Recurse -Force -ErrorAction SilentlyContinue
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "Updating PlatformIO core..."
|
||||||
|
try {
|
||||||
|
pio update
|
||||||
|
Write-Host "Running initial build to download fresh packages..."
|
||||||
|
pio run
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
Write-Host "Error: Build failed after package cleanup" -ForegroundColor Red
|
||||||
|
Write-Host "Try running: pio platform install ststm32" -ForegroundColor Yellow
|
||||||
|
Read-Host "Press Enter to exit"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
Write-Host "✓ Framework modules initialized" -ForegroundColor Green
|
||||||
|
} catch {
|
||||||
|
Write-Host "Error: Failed to clean and rebuild packages - $_" -ForegroundColor Red
|
||||||
|
Read-Host "Press Enter to exit"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Double-check after potential build
|
||||||
|
if (-not (Test-Path $LORAMAC_NODE)) {
|
||||||
|
Write-Host "Error: LoRaMAC-Node still not found at $LORAMAC_NODE" -ForegroundColor Red
|
||||||
|
Write-Host "Please check PlatformIO installation and project configuration" -ForegroundColor Yellow
|
||||||
Read-Host "Press Enter to exit"
|
Read-Host "Press Enter to exit"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user