angular / angular-cli

CLI tool for Angular
https://cli.angular.io
MIT License
26.76k stars 11.98k forks source link

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

Closed rolandoesc closed 6 years ago

rolandoesc commented 7 years ago

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.

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

NandaKishorJeripothula commented 7 years ago

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 commented 7 years ago

@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

powerfulman86 commented 7 years ago

same issue system : Ubuntu 16.04 X64 node 7.10.1 npm 4.2.0

rolandoesc commented 7 years ago

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

phippsbd1 commented 7 years ago

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

wvicioso commented 7 years ago

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

krishnabangalore commented 7 years ago

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

hansl commented 7 years ago

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

phippsbd1 commented 7 years ago

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

patocardo commented 6 years ago

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.

rolandoesc commented 6 years ago

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.

yeshesvi commented 6 years ago

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.

Callie-C-Wang commented 6 years ago

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

powerfulman86 commented 6 years ago

@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

Callie-C-Wang commented 6 years ago

@powerfulman86 My system is Microsoft Windows [Version 6.1.7601]

embryologist commented 6 years ago

same issue here, only one folder rxjs exists though

alan-agius4 commented 6 years ago

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.

angular-automatic-lock-bot[bot] commented 5 years ago

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.