angular-cli: Error "Tree type is not supported." when generating new module in v6.1.1
Bug Report or Feature Request (mark with an x)
- [ X ] bug report -> please search issues before submitting
- [ ] feature request
Command (mark with an x)
- [ ] new
- [ ] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ X ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc
Versions
Angular CLI 6.1.1 Windows 10 Node 10.7.0 Yarn 1.9.2
Repro steps
Upgrade to the latest version of Angular 6.1.1 (Works okay on 6.1.0)
run ng g module modules/test2 --flat
or just ng g module modules/test2
or just ng g module test2
or just ng g m test2
Interestingly, it works when generating modules with routing flag, but haven’t had any success with any other flags
ng g module modules/test2 --flat -routing or ng g module test2 --routing works.
The log given by the failure
I am getting a simple message without any other details attached:
Tree type is not supported.
Not enough information to help me troubleshoot where the problem is. I tried this on two of my projects.
Desired functionality
Should generate a new module in the specified location.
UPDATE
I also deleted the entire node_modules folder and re installed the packages without success. Downgrading back to 6.1.0 works as expected.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 5
- Comments: 39 (3 by maintainers)
Commits related to this issue
- fix(@angular-devkit/schematics): improve tree type checking Fixes #11683 — committed to clydin/angular-cli by clydin 6 years ago
- fix(@angular-devkit/schematics): improve tree type checking Fixes #11683 — committed to angular/angular-cli by clydin 6 years ago
Updating my custom schematic to:
And Angular CLI:
Still gives the error:
Am I missing something else?
I ran
yarn installandyarn upgradeand then it worked.Clean install of latest Angular CLI this morning. v6.1.1
I also get this message when running:
I also tried 6.1.0 same error. I had to downgrade CLI version to 6.0.7 in order for
ng newto work.As @StephenFluin note in another post. I reinstall @angular/cli from global and project itself. It solved the issue.
Got similar issues
Here’s the schematic versions
Tree.optimize() is not a functionwas fixed in https://github.com/angular/angular-cli/pull/11693 (which isn’t released yet but will be in 6.1.2 this Wednesday).I’m keeping this issue open as we need to figure out forward compatibility in Schematics for people who have multiple version of a library.
@nisimjoseph thx - that helped. I am using angular/cli 6.1.4. Solution: 1 ) delete node-modules folder and 2) package-lock file 3) then run npm install.
try to remove the entire node_module folder + delete package_lock file.
After investigating I found that in the following code:
tree instanceof host_tree_1.HostTreereturns false in my custom schematics.@odahcam Thanks. I can confirm that works. I first removed the
node_modulesdirectory, then ranyarn installand then ranyarn upgrade.Upgrade from 6.0.7 to 6.1.0 has the same issue with ‘generate’ command. Output: