x)- [ X ] bug report -> please search issues before submitting
- [ ] feature request
x)- [ ] new
- [ ] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ X ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc
Angular CLI 6.1.1
Windows 10
Node 10.7.0
Yarn 1.9.2
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 -routingor ng g module test2 --routingworks.
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.
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 ranyarn 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.
nope, global reinstall did not help. I guess I want routing!
@toddwseattle try updating your packages using npm (npm update). That's how i solved the issue, although am using yarn but I am guessing it should work for npm too.
@mainawycliffe npm update did not solve...moved on with the --routing work around
There is something wrong with the filter function, when I removed it, it works fine.
const templateSource = apply(url('./files'), [
options.spec ? noop() : filter(path => !path.endsWith('.spec.ts')),
template({
...stringUtils,
...options
}),
move(parsedPath.path)
]);
This works:
const templateSource = apply(url('./files'), [
template({
...stringUtils,
...options
}),
move(parsedPath.path)
]);
After investigating I found that in the following code:
function filter(predicate) {
return ((tree) => {
// TODO: Remove VirtualTree usage in 7.0
if (tree instanceof virtual_1.VirtualTree) {
return new filtered_1.FilteredTree(tree, predicate);
}
else if (tree instanceof host_tree_1.HostTree) {
return new host_tree_1.FilterHostTree(tree, predicate);
}
else {
throw new exception_1.SchematicsException('Tree type is not supported.');
}
});
}
tree instanceof host_tree_1.HostTree returns false in my custom schematics.
As @StephenFluin note in another post.
I reinstall @angular/cli from global and project itself. It solved the issue.
I get the same problem with @angular/[email protected]
impossible to get rid of this error. I tried both npm update and delete/reinstall both my project's node_modules and the global angular/cli installation without success.
try to remove the entire node_module folder + delete package_lock file.
Thank you @nisimjoseph . That saved me some pain.
Same issue Tree type is not supporteed but generating ngrx action. any workaround for this?
Same again here, my command line:
ng generate action Bookings --group
Any suggestions? I'm assuming there's some issue with the following file:
node_modules\@ngrx\schematics\src\action\index.ts
@inthegarage please refer this issue
I was able to solve the issue.
I'm having the same issue. Bumped into it when writing my own schematic. My tests work fine, but when I run the actual schematic using the schematics-cli I got the error. Turns out the angular-cli also gives the error, so it must be something in @schematics/angular?
Angular CLI: 6.1.3
Node: 8.11.3
OS: win32 x64
Angular: undefined
...
Package Version
------------------------------------------------------
@angular-devkit/architect 0.7.3 (cli-only)
@angular-devkit/core 0.7.3
@angular-devkit/schematics 0.7.3
@schematics/angular 0.7.3
@schematics/update 0.7.3 (cli-only)
rxjs 6.2.2
typescript 2.9.2
I'm also experiencing this issue.
Seems to have something to do with this commit: https://github.com/angular/angular-cli/commit/9582b84603182d43dbb9f0e6a8db600e83921f8a
@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.
Why is this issue closed? This is still a problem in this version. Uninstalling and reinstalling cli does not work. It is also not fixed with downgrading.
@will0684 I just posted above your comment. Please try it.
The issue is closed automatically when the PR is merged that fixes it. You can get the fixed version from our snapshot build now
https://github.com/angular/cli-builds
or wait for a release that includes the fix if you want to verify it from an npm install.
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._
Most helpful comment
Updating my custom schematic to:
And Angular CLI:
Still gives the error:
Am I missing something else?