You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Angular CLI v8 ng new generates Angular v7 files #14603
This issue was resolved by removing an errant node-modules folder. It appears that it invokes the local CLI when one exists and one existed in the node-modules folder.
Suggested change (from Filipe): "We can detect whether or not the command runs in a workspace and that should bound the mechanism for using the local version."
I don't know if this picture is accurate, but what it sounds like is that you were in a directory with a node_modules folder that contained v7 of the Angular CLI and when running ng new myApp it installed Angular v7.
After removing the node_modules folder, and running the command again, npm used the global version of the Angular CLI (v8) and installed v8 of Angular.
If this is accurate, there isn't a bug here, this is just the way node and npm work.
ng new is intended to be a global command. The problem here is that it is also a local command (albeit a non-functional local command if within a workspace).
The directory where I'm using ng new doesn't have any modules installed.
$ npm list
/Users/<user>/code
└── (empty)
$ ng --version
Angular CLI: 6.0.8
Node: 12.4.0
OS: darwin x64
Angular:
...
Package Version
------------------------------------------------------
@angular-devkit/architect <error>
@angular-devkit/core <error>
@angular-devkit/schematics <error>
@schematics/angular <error>
@schematics/update <error>
rxjs <error>
The directory where using ng new command has a lot other Angular project directories, can it be that ng tries to use @angular/cli from some subdirectory's node_modules?
I just ran into this issue for several hours. I had a node_modules directory in the directory I was running ng new from and didn't realize it. Would definitely be nice to have a warning message.
Activity
DeborahK commentedon May 31, 2019
This issue was resolved by removing an errant node-modules folder. It appears that it invokes the local CLI when one exists and one existed in the node-modules folder.
Suggested change (from Filipe): "We can detect whether or not the command runs in a workspace and that should bound the mechanism for using the local version."
markgoho commentedon Jun 2, 2019
I don't know if this picture is accurate, but what it sounds like is that you were in a directory with a node_modules folder that contained v7 of the Angular CLI and when running
ng new myAppit installed Angular v7.After removing the node_modules folder, and running the command again, npm used the global version of the Angular CLI (v8) and installed v8 of Angular.
If this is accurate, there isn't a bug here, this is just the way node and npm work.
mgechev commentedon Jun 11, 2019
Maybe it's worth outputting a warning message to set clear expectations.
clydin commentedon Jun 12, 2019
ng newis intended to be a global command. The problem here is that it is also a local command (albeit a non-functional local command if within a workspace).rubiesonthesky commentedon Jun 12, 2019
I have problem where the new project is Angular 6. Global cli is latest.
The directory where I'm using ng new doesn't have any modules installed.
The directory where using ng new command has a lot other Angular project directories, can it be that
ngtries to use @angular/cli from some subdirectory's node_modules?abierbaum commentedon Dec 10, 2019
I just ran into this issue for several hours. I had a node_modules directory in the directory I was running
ng newfrom and didn't realize it. Would definitely be nice to have a warning message.fix(@angular/cli): use global version of the CLI when running `ng new`
fix(@angular/cli): use global version of the CLI when running `ng new`
fix(@angular/cli): use global version of the CLI when running `ng new`
fix(@angular/cli): use global version of the CLI when running `ng new`
fix(@angular/cli): use global version of the CLI when running `ng new`
angular-automatic-lock-bot commentedon Dec 17, 2022
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.