You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Angular 10在Windows 10下无法运行,执行ng serve时出错求助

Fixing Angular 10 ng serve Errors on Windows 10

Hey there! Let’s work through this Angular 10 issue together. Since I can’t see the error screenshot you mentioned, I’ll share the most common solutions that resolve ng serve failures on Windows 10—these fix most cases:

  • Clean up dependencies and cache
    First, wipe out old dependencies and cached data that might be corrupted:

    1. Delete the node_modules folder and lock file in your project:
      rmdir /s node_modules
      del package-lock.json
      
    2. Reinstall fresh, uncorrupted dependencies:
      npm install
      
    3. Clear Angular’s global cache to eliminate stale build data:
      ng cache clean --force
      
  • Verify Node.js version compatibility
    Angular 10 strictly requires Node.js versions between 12.x and 14.x (it doesn’t support 15+). Check your current version with:

    node -v
    

    If it’s outside this range, install a compatible LTS version (Node 14 works perfectly for Angular 10) and retry.

  • Repair Angular CLI installation
    Outdated or mismatched CLI versions are a frequent culprit. Fix this by:

    1. Uninstall the global CLI to remove any broken instances:
      npm uninstall -g @angular/cli
      
    2. Reinstall the Angular 10-specific CLI globally:
      npm install -g @angular/cli@10.x.x
      
    3. Sync your local project’s CLI version to match the global one:
      npm install --save-dev @angular/cli@10.x.x
      
  • Check for port conflicts
    The default ng serve port (4200) might be used by another app (like a local server or background service). Try running on a different port:

    ng serve --port 4201
    

    Or find and kill the process using port 4200 with:

    netstat -ano | findstr :4200
    

    Then use Task Manager to end the process with the matching PID.

  • Temporarily disable security tools
    Windows Defender or third-party antivirus/firewall software sometimes blocks Angular’s file access during builds. Turn these off temporarily and run ng serve to test if that resolves the issue.

  • Validate project configuration files
    Double-check your core config files for typos or incompatible settings:

    • Ensure the architect > serve section in angular.json has no path errors or invalid options.
    • Confirm tsconfig.json sets target to ES2015 or ES2016 (the compatible versions for Angular 10).

If none of these work, please share the exact error text from your terminal (copy-paste the key lines)—that will help me pinpoint the exact problem!

内容的提问来源于stack exchange,提问作者Emy

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.09 12:22:45