angular-cli: Cannot initialize a new project after installing angular/cli 1.4.7 - Error: tree.branch is not a function

Bug Report or Feature Request (mark with an x)

- [ x ] bug report -> please search issues before submitting
- [ ] feature request

Versions.

@angular/cli: 1.4.7 node: 8.6.0 os: linux x64

Repro steps.

  • Installed Ubuntu GNOME 16.04
  • Installed npm, node, angular/cli
  • Tried to create a new angular project

The log given by the failure.

Error: tree.branch is not a function tree.branch is not a function

Desired functionality.

To create a new angular project

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 1
  • Comments: 18 (1 by maintainers)

Most upvoted comments

Doing this worked for me. Thanks to @dharders

i.e.

find ./node_modules -type d | grep "/rxjs$"

./node_modules/@angular/cli/node_modules/rxjs
./node_modules/@angular/core/node_modules/rxjs
./node_modules/@angular/http/node_modules/rxjs
./node_modules/@angular/router/node_modules/rxjs
./node_modules/rxjs

Then after manual deletion of sub-directories:

find ./node_modules -type d | grep "/rxjs$"

./node_modules/rxjs

Then ng new works without any problems.

@yeshesvi Thanks for your example, your solution works for me. I delete duplicated rxjs folders and files. Then issue is solved.

tree.branch is not a function is being worked on, but in the meantime I can tell you why it happens; you have two different RxJS installed in your node_modules, and your schematics is using one while the CLI is using another. Check your dependencies with npm ls

@rolandoesc found a solution…

Development Hints for working on Angular CLI

Working with master

git clone https://github.com/angular/angular-cli.git cd angular-cli npm link

Documentation from https://github.com/angular/angular-cli helped… its not a global installation but works fine