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

Created on 14 Oct 2017  路  18Comments  路  Source: angular/angular-cli

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

investigation 1 (urgent) bufix

Most helpful comment

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.

All 18 comments

same issue here
system config:
Windows 10 Pro
X64 intel

$ node -v
v6.11.4
$ npm -v
3.10.10
$ ng new testApp
Error: tree.branch is not a function
tree.branch is not a function

@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

same issue
system :
Ubuntu 16.04
X64
node 7.10.1
npm 4.2.0

@NandaKishorJeripothula

Yeah, it worked for me as well, I hope someone can give us an idea of how to solve it without any "workaround". Thanks for your help! :)

I am having the same error pop up since upgrading to CLI 1.4.7. I've been trying to create new components and services though, not just new apps and projects.

System:
@angular/cli: 1.4.7
node: 6.10.3
os: win32 x64

C:\Project>ng generate service services/test-service Error: tree.branch is not a function tree.branch is not a function

Same issue.

@angular/cli: 1.4.5
node: 6.11.4
os: win32 x64

I tried tried install globally. When I try to initialize a new project I get Error: tree.branch is not a function

same issue here as well but on Linux

did anyone solve it
I tried to generate a component
ng generate component component-name

and got errors
Error: tree.branch is not a function

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

@hansl Thanks for the tip. I dumped my node_modules folder and reinstalled and that fixed the error.

After several different attempts, I couldn't make cli works. The workaround I found is to clone the quickstart, and use the npm scripts instead of ng.

I know this isn't a solution to the case, but I changed my Ubuntu shell and everything went perfectly.

In my situation, I was using LTS 16.04 with GNOME when this happened, but now I'm using LTS 16.04 with Unity Shell.

I hope this helps in order to find a solution.

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.

@yeshesvi
thank you for your effort .
but still didn't work for me .

@Callie-C-Wang
what is your os !

$ find ./node_modules -type d | grep "/rxjs$"
./node_modules/rxjs
$ cd Projects/
Projects$ ng new firstangapp
Error: tree.branch is not a function
tree.branch is not a function

@powerfulman86
My system is Microsoft Windows [Version 6.1.7601]

same issue here, only one folder rxjs exists though

Thanks for reporting this issue. This issue is now obsolete due to changes in the recent releases. Please update to the most recent Angular CLI version.

If the problem persists after upgrading, please open a new issue, provide a simple repository reproducing the problem, and describe the difference between the expected and current behavior.

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings