angular-cli: ng new not working @6.0.0

Versions

NPM 5.6.0 Angular CLI: 6.0.0 Node: 10.0.0 OS: win32 x64 Angular: … Package Version angular-devkit/architect 0.6.0 angular-devkit/core 0.6.0 angular-devkit/schematics 0.6.0 schematics/angular 0.6.0 schematics/update 0.6.0 rxjs 6.1.0 typescript 2.7.2

Repro steps

ng new ng-app

Observed behavior

Commande output:

Schematic "ng-new" not found in collection "@schematics/angular".
Error: Schematic "ng-new" not found in collection "@schematics/angular".
    at SchematicEngine.createSchematic (C:\Users\User\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\@angular-devkit\schematics\src\engine\engine.js:155:23)
    at CollectionImpl.createSchematic (C:\Users\User\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\@angular-devkit\schematics\src\engine\collection.js:12:29)
    at NodeWorkflow.execute (C:\Users\User\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\@angular-devkit\schematics\tools\workflow\node-workflow.js:70:38)
    at Promise (C:\Users\User\AppData\Roaming\npm\node_modules\@angular\cli\models\schematic-command.js:141:22)
    at new Promise (<anonymous>)
    at NewCommand.runSchematic (C:\Users\User\AppData\Roaming\npm\node_modules\@angular\cli\models\schematic-command.js:140:16)
    at NewCommand.<anonymous> (C:\Users\User\AppData\Roaming\npm\node_modules\@angular\cli\commands\new.js:77:25)
    at Generator.next (<anonymous>)
    at C:\Users\User\AppData\Roaming\npm\node_modules\@angular\cli\commands\new.js:7:71
    at new Promise (<anonymous>)

Desired behavior

Should generate angular app

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 20 (3 by maintainers)

Most upvoted comments

From the output from the second command it appears that there is a node_modules folder (and potentially package.json) with both the CLI and an old version of @schematics/angular installed locally (C:\Users\User). This is most likely the source of the problem and under typical scenarios should not be present.

@clydin You are right, there is a node_modules folder in C:\Users\User\, and removing the folder solved the problem. Thank you, and sorry for the trouble.

Could you provide the output of both the following commands?

npm ls -g @schematics/angular
npm ls @schematics/angular

npm install -g npm npm uninstall -g angular-cli npm cache clean npm install -g @angular/cli@lates

No problem. I’m glad you got it sorted out.