Skip to content

Commit 0d6d1bf

Browse files
committed
fix(@angular/cli): use global version of the CLI when running ng new
In some cases orphan `node_modules` could cause the non global CLI to be used to generate a new workspace. Closes angular#14603
1 parent 42758b9 commit 0d6d1bf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/angular/cli/lib/init.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,17 @@ let forceExit = false;
3333
* See: https://github.com/browserslist/browserslist/blob/819c4337456996d19db6ba953014579329e9c6e1/node.js#L324
3434
*/
3535
process.env.BROWSERSLIST_IGNORE_OLD_DATA = '1';
36+
const rawCommandName = process.argv[2];
3637

3738
/**
3839
* Disable CLI version mismatch checks and forces usage of the invoked CLI
3940
* instead of invoking the local installed version.
4041
*/
41-
if (disableVersionCheck) {
42+
if (disableVersionCheck || rawCommandName === 'new') {
4243
return (await import('./cli')).default;
4344
}
4445

4546
let cli;
46-
const rawCommandName = process.argv[2];
4747

4848
try {
4949
// No error implies a projectLocalCli, which will load whatever

0 commit comments

Comments
 (0)