-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfix-invalid-version-error.ps1
More file actions
28 lines (20 loc) · 1.03 KB
/
fix-invalid-version-error.ps1
File metadata and controls
28 lines (20 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# PowerShell script to fix npm "Invalid Version" error by cleaning lock files, cache, and reinstalling dependencies
Write-Host "Closing any running dev servers, editors, or programs using the project files is recommended before running this script."
# Run PowerShell as Administrator before executing this script
# Define the project root path
$projectRoot = "solia"
# Delete lock files if they exist
Write-Host "Deleting package-lock.json and pnpm-lock.yaml if they exist..."
Remove-Item -Path "$projectRoot\package-lock.json" -Force -ErrorAction SilentlyContinue
Remove-Item -Path "$projectRoot\pnpm-lock.yaml" -Force -ErrorAction SilentlyContinue
# Delete node_modules folder
Write-Host "Deleting node_modules folder..."
Remove-Item -Path "$projectRoot\node_modules" -Recurse -Force -ErrorAction SilentlyContinue
# Clear npm cache
Write-Host "Clearing npm cache..."
npm cache clean --force
# Reinstall dependencies
Write-Host "Reinstalling dependencies..."
cd $projectRoot
npm install
Write-Host "Done. Please try running your npm command again."