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.
Clean install of latest Angular CLI this morning. v6.1.1
I also get this message when running:
ng new --style=scss --routing --skip-tests --skip-git example
I also tried 6.1.0 same error. I had to downgrade CLI version to 6.0.7 in order for ng new to work.
@darrenmothersele That's interesting, because I tried to run the above command on my v6.1.1 and it was successfully executed. I also went ahead and created a new project and run the commands that could not executed earlier successfully without any issues. On my part, it seems to be an issue with upgrading to Angular 6.1.1 from 6.1.0.
Versions Angular CLI: 6.1.1 Node: 8.11.3 OS: linux x64 I got the same problem and unable to downgrade the version of angular/cli. Removed node, npm and angular and again install them with the angular version 6.1.0. But it still shows the above versions. The issue is not resolved. Can anyone help me to find the root cause of the issue.
Hi,
Could you run npm ls @angular-devkit/schematics on your command line and paste the output here?
Also, as a way to try to fix this, could you try getting rid of you node_modules folder and reinstalling your project packages?
Here is the output of the npm ls @angular-devkit/schematics
[email protected] C:\Users\maina\Projects\hades
+-- @angular/[email protected]
| +-- @angular-devkit/[email protected]
| +-- @schematics/[email protected]
| | `-- @angular-devkit/[email protected] deduped
| `-- @schematics/[email protected]
| `-- @angular-devkit/[email protected] deduped
`-- @angular/[email protected]
+-- @angular-devkit/[email protected]
`-- @schematics/[email protected]
`-- @angular-devkit/[email protected]
I already tried to remove the entire node_modules folder and reinstalling the packages without success.
Upgrade from 6.0.7 to 6.1.0 has the same issue with 'generate' command. Output:
ng g service ExampleService
newTree.optimize is not a function
@adnanebrahimi Am also getting the same error on both 6.1.0 and 6.1.1.
newTree.optimize is not a function
Any news on this? I was getting newTree.optimize is not a function, then, after updating my custom schematics to 0.7, I'm getting Tree type is not supported.
I ran yarn install and yarn upgrade and then it worked.
@odahcam Thanks. I can confirm that works. I first removed the node_modules directory, then ran yarn install and then ran yarn upgrade.
It seems like ng update is not updating some schematics packages. Some were still stack at 0.7.0 but after yarn upgrade, all are updated to 0.7.1
Before:
+-- @angular/[email protected]
| +-- @angular-devkit/[email protected]
| +-- @schematics/[email protected]
| | `-- @angular-devkit/[email protected] deduped
| `-- @schematics/[email protected]
| `-- @angular-devkit/[email protected] deduped
`-- @angular/[email protected]
+-- @angular-devkit/[email protected]
`-- @schematics/[email protected]
`-- @angular-devkit/[email protected]
After:
+-- @angular/[email protected]
| +-- @angular-devkit/[email protected]
| +-- @schematics/[email protected]
| | `-- @angular-devkit/[email protected] deduped
| `-- @schematics/[email protected]
| `-- @angular-devkit/[email protected] deduped
`-- @angular/[email protected]
`-- @angular-devkit/[email protected] deduped
+1
Tree.optimize() is not a function was 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.
6.1.2 will also support backward compatibility?
Got similar issues
> ng g c compName
Tree type is not supported.
Here's the schematic versions
> npm ls @angular-devkit/schematics
`-- @angular/[email protected]
+-- @angular-devkit/[email protected]
+-- @schematics/[email protected]
| `-- @angular-devkit/[email protected]
`-- @schematics/[email protected]
`-- @angular-devkit/[email protected]
> ng --version
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 6.1.1
Node: 9.10.1
OS: win32 x64
Angular: 6.1.0
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.7.1
@angular-devkit/build-angular 0.7.1
@angular-devkit/build-optimizer 0.7.1
@angular-devkit/build-webpack 0.7.1
@angular-devkit/core 0.7.1
@angular-devkit/schematics 0.7.1
@angular/cdk 6.4.2
@angular/cli 6.1.1
@angular/flex-layout 6.0.0-beta.17
@angular/material 6.4.2
@ngtools/webpack 6.1.1
@schematics/angular 0.7.1
@schematics/update 0.7.1
rxjs 6.2.2
typescript 2.9.2
webpack 4.9.2
Updating my custom schematic to:
"@angular-devkit/architect": "0.7.2",
"@angular-devkit/core": "0.7.2",
"@angular-devkit/schematics": "0.7.2",
And Angular CLI:
"@angular-devkit/build-angular": "0.7.2",
"@angular/cli": "~6.1.2",
Still gives the error:
Tree type is not supported.
Am I missing something else?
Here too, the problem still exists. I have to run yarn upgrade after upgrading to 6.2.2 for everything to work as expected.
Something new about this? I can't publish a new release of my custom schematics.
I solved this issue by updating all cli packages individually that listed in readme
Having this same problem. ng g module shared -d returns Tree Type Not Supported error.
npm ls @angular-devkit/schematics returns:
+-- @angular/[email protected]
| +-- @angular-devkit/[email protected]
| +-- @schematics/[email protected]
| | `-- @angular-devkit/[email protected] deduped
| `-- @schematics/[email protected]
| `-- @angular-devkit/[email protected]
`-- @angular/[email protected]
+-- @angular-devkit/[email protected]
`-- @schematics/[email protected]
`-- @angular-devkit/[email protected] deduped
and ng -v returns:
Angular CLI: 6.1.2
Node: 8.9.3
OS: win32 x64
Angular: 6.1.1
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.7.2
@angular-devkit/build-angular 0.7.2
@angular-devkit/build-optimizer 0.7.2
@angular-devkit/build-webpack 0.7.2
@angular-devkit/core 0.7.2
@angular-devkit/schematics 0.7.2
@angular/cdk 6.4.2
@angular/cli 6.1.2
@angular/material 6.4.2
@angular/pwa 0.7.2
@ngtools/webpack 6.1.2
@schematics/angular 0.7.2
@schematics/update 0.7.2
rxjs 6.2.2
typescript 2.7.2
webpack 4.9.2
like @MainaWycliffe said in the first report, seems to work if you do --module flag.
will try re-installing cli globally as @StephenFluin did to see if it helps.
I'm using npm not yarn.