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

升级Angular CLI至6.0.0后无法创建Angular 6新项目

Fixing Angular CLI 6.0.0 Upgrade & ng new Errors

Hey there, let's work through the issues you're hitting after upgrading to Angular CLI 6.0.0! These kinds of glitches are pretty common with major CLI version jumps, so here are practical steps to resolve them:

Step 1: Clean Up Old CLI Installs & Cache

First, let's wipe out any leftover global CLI files and clear npm's cache to eliminate corrupted data:

npm uninstall -g @angular/cli
npm cache clean --force

(Note: For npm 5+, you can also use npm cache verify, but clean --force is more thorough for troubleshooting.)

Step 2: Verify Node.js Compatibility

Angular CLI 6.0.0 requires Node.js 8.x or higher. Check your current version with:

node -v

If your Node version is below 8.x, upgrade to a compatible LTS release—this is a frequent culprit for post-upgrade errors.

Step 3: Reinstall the Exact CLI Version

Now install the 6.0.0 version globally:

npm install -g @angular/cli@6.0.0

Step 4: Confirm the CLI Version

Run this command to make sure the version is showing correctly:

ng --version

You should see @angular/cli: 6.0.0 listed here.

Step 5: Troubleshoot ng new Errors

If creating a new project still fails:

  • Make sure you're in an empty directory (no existing node_modules or package-lock.json files that might conflict).
  • Try using npx to run the CLI directly, bypassing any global install quirks:
    npx @angular/cli@6.0.0 new my-app
    
  • On Linux/macOS, ensure you have proper permissions (run the command with sudo if needed); on Windows, open your command prompt as an administrator.

Why This Happens

Most often, these issues stem from:

  • Residual cache files from previous CLI versions
  • Mismatched global/local CLI versions
  • Incompatible Node.js versions that don't support CLI 6.0.0

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.27 04:25:31