angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

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

Open ochaminho opened this issue 9 years ago • 18 comments

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

ochaminho avatar Oct 14 '17 05:10 ochaminho

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

NandaKishorJeripothula avatar Oct 14 '17 06:10 NandaKishorJeripothula

@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

NandaKishorJeripothula avatar Oct 14 '17 06:10 NandaKishorJeripothula

same issue system : Ubuntu 16.04 X64 node 7.10.1 npm 4.2.0

powerfulman86 avatar Oct 14 '17 09:10 powerfulman86

@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! :)

ochaminho avatar Oct 14 '17 16:10 ochaminho

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

phippsbd1 avatar Oct 16 '17 14:10 phippsbd1

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

wvicioso avatar Oct 16 '17 15:10 wvicioso

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

krishnabangalore avatar Oct 16 '17 15:10 krishnabangalore

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 avatar Oct 16 '17 16:10 hansl

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

phippsbd1 avatar Oct 16 '17 19:10 phippsbd1

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.

patocardo avatar Oct 27 '17 00:10 patocardo

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.

ochaminho avatar Oct 27 '17 16:10 ochaminho

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 avatar Oct 29 '17 19:10 yeshesvi

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

Callie-C-Wang avatar Nov 08 '17 03:11 Callie-C-Wang

@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 avatar Nov 10 '17 07:11 powerfulman86

@powerfulman86 My system is Microsoft Windows [Version 6.1.7601]

Callie-C-Wang avatar Nov 10 '17 15:11 Callie-C-Wang

same issue here, only one folder rxjs exists though

ConClavi avatar Nov 27 '17 05:11 ConClavi

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.

alan-agius4 avatar Oct 11 '18 14:10 alan-agius4

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.