MAC下Angular 6.0.4执行ng new命令报错:Data path不应含dryRun属性
Hey there! I’ve run into this exact issue before with Angular CLI 6.x, so let’s get it sorted out for you.
What’s causing the error?
Angular CLI 6.0.4 changed how the dryRun parameter works — this property is no longer part of the core configuration schema that gets passed when creating a new project. Instead, it’s now a command-line flag (--dry-run) you can use if you want to preview the project setup without actually creating files. The error pops up because your CLI is trying to include dryRun as a top-level config property, which the 6.x schema doesn’t allow anymore.
Step-by-step fixes:
Check your CLI versions (global vs local)
First, make sure your global and local Angular CLI versions are consistent. Run this in your terminal:ng --versionIf you see a mismatch (e.g., global is a newer/older version than 6.0.4), that’s likely part of the problem.
Reinstall the correct global CLI version
Uninstall the existing global CLI and install the exact 6.0.4 version:npm uninstall -g @angular/cli npm install -g @angular/cli@6.0.4Clear npm cache to avoid residual issues
Sometimes cached packages can cause weird conflicts, so clear it out:npm cache clean --forceCreate the project without the problematic config
Now try creating your project again with the basic command — sincedryRunisn’t a valid top-level config anymore, just run:ng new happinessIf you want to test the setup first without creating files, use the command-line flag instead:
ng new happiness --dry-runRemove outdated CLI config files (if needed)
If you still run into issues, check your user directory for any old Angular CLI config files (like~/.angular-config.json) and delete them — these can sometimes carry over old settings that conflict with the 6.x schema.
That should resolve the schema validation error and let you create your Angular project successfully!
内容的提问来源于stack exchange,提问作者Bob Zheng

