Windows 8.1下Angular CLI安装失败求助:多次尝试仍中途卡顿
Hey there, let's work through this Angular CLI install issue you're hitting. The main culprit here is compatibility—your Node.js and npm versions are pretty old, and modern Angular CLI releases don't support them. Let's break down the fix step by step:
Step 1: Uninstall & Clean Up Residual Files
First, we need to make sure there's no leftover Angular CLI data causing conflicts:
- Uninstall the global Angular CLI package:
npm uninstall -g @angular/cli - Force-clear the npm cache (your older npm version works better with
clean --forceinstead ofverify):npm cache clean --force - Manually delete leftover CLI files:
- Run
npm root -gin your command prompt to find your global npm modules folder (usually something likeC:\Users\<YourUsername>\AppData\Roaming\npm\node_modules) - Delete the
@angularfolder inside that directory - Head to
C:\Users\<YourUsername>\AppData\Roaming\npmand delete any files starting withng(likeng.cmd,ng.ps1)
- Run
Step 2: Install a Compatible Angular CLI Version
Node v8.9.4 only supports Angular CLI versions up to v8.x.x. We'll install the last stable release of Angular 8's CLI, which works perfectly with your setup:
npm install -g @angular/cli@8.3.29
- Pro tip: If you're stuck on download steps due to network issues, use a domestic npm mirror to speed things up:
npm install -g @angular/cli@8.3.29 --registry=https://registry.npmmirror.com
Step 3: Verify the Installation
Once the install finishes, check if it worked by running:
ng --version
You should see the Angular CLI version (8.3.29) along with your Node.js version listed—this means the install was successful!
Quick Notes to Avoid Future Issues
- Always run your command prompt as Administrator when installing global npm packages on Windows—permission blocks are a common cause of interrupted installs.
- If you ever plan to upgrade Angular CLI later, you'll need to first upgrade Node.js to a version supported by newer CLI releases (though keep in mind Windows 8.1 has limited support for newer Node versions, so stick to LTS releases that still support Windows 8.1).
内容的提问来源于stack exchange,提问作者khush

