Today, I updated my angular cli to the latest version and encountered an error that stops me from creating a new Angular project. Following is the error log that I get after executing ng new app-name
:
Error: Schematic "ng-new" not found in collection "@schematics/angular".
at SchematicEngine.createSchematic (C:Usersxyz
ode_modules@angularcli
ode_modules@angular-devkitschematicssrcengineengine.js:155:23)
at CollectionImpl.createSchematic (C:Usersxyz
ode_modules@angularcli
ode_modules@angular-devkitschematicssrcenginecollection.js:12:29)
at NodeWorkflow.execute (C:Usersxyz
ode_modules@angularcli
ode_modules@angular-devkitschematicsoolsworkflow
ode-workflow.js:70:38)
at Promise (C:Usersxyz
ode_modules@angularclimodelsschematic-command.js:141:22)
at new Promise (<anonymous>)
at NewCommand.runSchematic (C:Usersxyz
ode_modules@angularclimodelsschematic-command.js:140:16)
at NewCommand.<anonymous> (C:Usersxyz
ode_modules@angularclicommands
ew.js:77:25)
at Generator.next (<anonymous>)
at C:Usersxyz
ode_modules@angularclicommands
ew.js:7:71
at new Promise (<anonymous>)
In order to solve the problem myself I have reinstalled angular cli as well as npm more than twice. The versions of packages are as follows:
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
Angular Cli 6.0.0
Node 8.11.1
npm 5.6.0
Any help would be appreciated.
Edit: I ran ng new from the place where the angular global packages are installed and I am able to create an an application from there. Running it from anywhere else, produces error.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…