-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
generate library with --routing fails silently #742
Comments
I had another look and the
So it seems that for the generation of the AST another TypeScript version is used. Looking at the actual |
Okay, it seems my @schematics/angular is outdated… I fixed it by removing Nevertheless, it would be an improvement to somehow notify the user that the dependencies don't match 😕 |
I also had this error and I realized that quite late after changing the dependency versions, did not create an app or lib soon afterwards (but I will test that in the future after updating a dependency). I had to play around with dependency versions concerning Now I am finally using Angular CLI: 6.1.3
Node: 8.10.0
OS: win32 x64
Angular: 6.1.8
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
Package Version
------------------------------------------------------------
@angular-devkit/architect 0.7.5
@angular-devkit/build-angular 0.7.5
@angular-devkit/build-optimizer 0.7.5
@angular-devkit/build-webpack 0.7.5
@angular-devkit/core 0.7.5
@angular-devkit/schematics 0.7.3
@angular/cdk 6.4.2
@angular/cli 6.1.3
@angular/flex-layout 6.0.0-beta.18
@angular/material 6.4.2
@angular/material-moment-adapter 6.4.2
@ngtools/webpack 6.1.5
@schematics/angular 0.7.3
@schematics/update 0.7.3
rxjs 6.2.2
typescript 2.9.2
webpack 4.9.2 and everything seems ok. What versions are you using at the moment? Having a list of compatible versions would be great, because somehow the |
Hi @luchsamapparat, If you still have the problem, could you please provide a reproduction of the issue? Thank you. |
@bcabanes I updated my project to Angular 6.1, Angular CLI 6.2.5 and Nx 6.4 and However, now
However, the directory is empty after the command finishes. I don't know if this is related or not. My global packages:
Creating an Angular Workspace first and then adding Nx works…
|
Hi @luchsamapparat! Concerning the new issue you encounter, I think we have new separate ticket available here #817 so I will close this one. |
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context. |
Hi,
unfortunately, I cannot provide a project to reproduce the issue right now. However, I've been debugging the issue and maybe someone has an idea what's going on.
Basically, I try to create a new library with routing:
ng generate library administration --routing
I narrowed the issue down to the routing param and started debugging the schematic. The execution fails in
insertAfterLastOccurrence
which throws an empty error. However, the problem is not within that method. thenodes
argument is an empty array.https://github.com/angular/angular-cli/blob/d202480a1707be6575b2c8cf0383cfe6db44413c/packages/schematics/angular/utility/ast-utils.ts#L195
This is the stack trace:
It happens when
addRouterConfiguration
callsinsertImport
with this source file:https://github.com/nrwl/nx/blob/master/packages/schematics/src/collection/library/index.ts#L90
The
insertImport
method then retrieves all imports viafindNodes
:const allImports = findNodes(rootNode, ts.SyntaxKind.ImportDeclaration);
https://github.com/angular/angular-cli/blob/d202480a1707be6575b2c8cf0383cfe6db44413c/packages/schematics/angular/utility/ast-utils.ts#L24
However, that methods returns an empty result in the error thrown as mentioned initially.
What really confuses me is the SyntaxKind enumeration. While debugging, it says
SyntaxKind.ImportDeclaration
has a value of239
.However, it seems that that number changes with every TypeScript release:
ImportDeclaration = 242,
https://github.com/Microsoft/TypeScript/blob/release-2.8/lib/typescript.d.ts#L306
ImportDeclaration = 243,
https://github.com/Microsoft/TypeScript/blob/release-2.9/lib/typescript.d.ts#L308
ImportDeclaration = 247,
https://github.com/Microsoft/TypeScript/blob/release-3.0/lib/typescript.d.ts#L322
Isn't that pretty fragile? Am I missing something here?
In my project I am using...
TypeScript 2.9.2
@nrwl/schematics 6.2.1
@schematics/angular 0.7.2
The text was updated successfully, but these errors were encountered: