I am new in angular 4. I am trying to create new Component using angular CLI.
command : ng generate component myFolder/newComponent
But I am getting below error:
Error: tree.branch is not a function
tree.branch is not a function.
I am new in angular 4. I am trying to create new Component using angular CLI.
command : ng generate component myFolder/newComponent
But I am getting below error:
Error: tree.branch is not a function
tree.branch is not a function.
It probably comes from your angular-cli installation/version. Try to uninstall/re-install it :
Re-install generally
npm uninstall -g @angular/cli
npm install -g @angular/cli
Re-install for a local project :
npm uninstall --save @angular/cli
npm install --save @angular/cli
Delete the node_modules folder and go to the path (myFolder) where you want to generate a new component and run the below command
ng g component my-new-component
Are you sure myFolder is a module in your project? If it is just a normal folder, I would recommend navigating inside the folder with cd manually and then doing the following
ng g c your-component-name.
When you enter ng g c folder-name/your-component-name, angular expects folder-name to actually be a module which consists of .module.ts file.