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

Angular CLI(v1.7.3)执行ng new命令报错,请求技术解决指导

Hey there, let's break down targeted troubleshooting steps to get your ng new command working with Angular CLI v1.7.3. I've dealt with similar version mismatch headaches before, so here's what I'd try:

Troubleshooting Steps for Angular CLI v1.7.3 ng new Error

1. Verify Exact Node.js Compatibility

Angular CLI v1.7.3 has strict Node.js version requirements—it works best with Node.js 8.x (LTS) or Node.js 9.x. Newer versions (like Node 10+) introduce breaking changes that clash with this older CLI, while overly old versions lack required features. Use nvm (Node Version Manager) to switch cleanly:

  • Install nvm if you haven’t already
  • Run nvm install 8.17.0 (a stable LTS build for this CLI version)
  • Run nvm use 8.17.0
  • Retry ng new your-project-name

2. Full Clean Uninstall & Reinstall of Angular CLI v1.7.3

Leftover files from previous CLI versions often cause hidden conflicts. Let’s wipe and reinstall properly:

  • Uninstall global CLI: npm uninstall -g @angular/cli
  • Clear npm cache: npm cache clean --force
  • Verify no CLI remains: ng --version (should throw "command not found")
  • Reinstall the exact v1.7.3: npm install -g @angular/cli@1.7.3
  • Try creating your project again

3. Match npm Version to Node.js 8.x

Node.js 8.x pairs best with npm 5.x. Newer npm versions (6+) can break compatibility with the older CLI:

  • Check your npm version: npm --version
  • If it’s 6+, downgrade: npm install -g npm@5.10.0
  • Retry the ng new command

4. Enable Verbose Logging to Pinpoint the Error

Get detailed logs to see exactly where the process fails:

  • Run ng new your-project-name --verbose
  • Look for specific errors like missing dependencies, network timeouts, or permission blocks. For network issues, you can reset your npm registry temporarily: npm config set registry https://registry.npmjs.org/

5. Check System Permissions

Permission restrictions can prevent the CLI from creating files or installing dependencies:

  • On macOS/Linux: Test with sudo ng new your-project-name (note: using sudo regularly isn’t ideal, but this confirms a permission issue. Fix npm permissions afterward to avoid needing sudo.)
  • On Windows: Run Command Prompt/PowerShell as Administrator and retry the command

6. Temporarily Disable Antivirus/Firewall

Rarely, security software blocks the CLI from downloading dependencies or writing files. Disable your antivirus/firewall briefly and run ng new—if it works, add an exception for the Angular CLI or your project directory.

内容的提问来源于stack exchange,提问作者Abdul Jabbar Azam

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.20 09:03:18