Converting an existing angular 2 project to use angular CLI -


i have project not created using ng new (rather, followed quickstart guide). when run angular cli command in project (such ng generate) error message:

you have inside angular-cli project in order use generate command.

is there way can turn existing project angular-cli project? (i wanted try using because apparently automatically works around an issue barrel imports , systemjs.)

you should able run ng init , follow prompts. have @ issue if need guidance: https://github.com/angular/angular-cli/issues/755

edit (march 13, 2017):

ng-init removed latest version of angular cli. https://github.com/angular/angular-cli/pull/4628

so you'll need resort mimicking tried accomplish. ie:

  1. create new angular project ng new mytemplate

  2. copy relevant files existing project new mytemplate project:

    .angular-cli.json package.json tslint.json src/polyfills.ts src/styles.css src/tsconfig.json

depending on state of existing application may want copy on way more or way less. guess why feature removed cli. there isn't way know want do.


Comments