Nx: Cannot generate apps using "ng new app ..."

Created on 14 Aug 2018  ·  10Comments  ·  Source: nrwl/nx

I just did a fresh install of @angular/cli and @nrwl/schematics using the following documentation:

https://nrwl.io/nx/guide-getting-started

I did created my workspace using:

create-nx-workspace myworkspacename

everything so far but does not matter what I do I cannot make this command to work:

ng generate app myapp

I always get the following error:

Cannot read property 'kind' of undefined

I have installed the following packages:

Angular CLI: 6.1.3
Node: 8.9.0
OS: darwin x64
Angular: 6.1.2
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.6.8
@angular-devkit/build-angular     0.6.8
@angular-devkit/build-optimizer   0.6.8
@angular-devkit/core              0.7.3
@angular-devkit/schematics        0.7.3
@angular/cli                      6.1.3
@ngtools/webpack                  6.0.8
@schematics/angular               0.7.3
@schematics/update                0.7.3
rxjs                              6.2.2
typescript                        2.7.2
webpack                           4.8.3

Am I missing something here? I am totally new to nx but I find it pretty powerful, I really want to give it a try.

Thank you!

Most helpful comment

I did some research and found that this issue is a typescript related one.
So, after I have created the workspace I have upgraded typescript to version 2.9.2:
yarn add --dev typescript@~2.9.2

and them I was able to create two applications without any error.

All 10 comments

Are you using yarn as your package manager?

@AnyFlippingUsernameWillDo yes I am but I also tried it with npm. In fact and remove the installation of @angular/cli and clean npm cache (I know, kind of extreme but I wanted to make sure) then reinstalled everything using yarn first, did not work, then I didi the same with npm, did not work either. I even change ng package manger to yarn with:

ng config -g cli.packageManager yarn

Still nothing

I forgot to mention that I can create libs without any issues.

Yes, I had exactly the same issue which seemed to go away when I npm installed instead of using yarn. It could have been the result of some other magic though. Might be worth having a look at #701 as well which is similar.

I had the same problem.
The only difference is that I've used: ng new myworksp --collection=@nrwl/schematics

@AnyFlippingUsernameWillDo same happened to me I did re-tried with npm and I was able to do it. It is confusing and I am not sure which was the fix. Not sure if I should close this thread though??

I too have this issue and am willing to provide any additional information if required

C:\Projects\sblowes\testnx (master)
λ npm -v
5.6.0

C:\Projects\sblowes\testnx (master)
λ node -v
v8.11.3

C:\Projects\sblowes\testnx (master)
λ tsc -v
Version 3.0.1

C:\Projects\sblowes\testnx (master)
λ ng -v

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 6.1.3
Node: 8.11.3
OS: win32 x64
Angular: 6.1.3
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.6.8
@angular-devkit/build-angular     0.6.8
@angular-devkit/build-optimizer   0.6.8
@angular-devkit/core              0.7.3
@angular-devkit/schematics        0.7.3
@ngtools/webpack                  6.0.8
@schematics/angular               0.7.3
@schematics/update                0.7.3
rxjs                              6.2.2
typescript                        2.7.2
webpack                           4.8.3

I did some research and found that this issue is a typescript related one.
So, after I have created the workspace I have upgraded typescript to version 2.9.2:
yarn add --dev typescript@~2.9.2

and them I was able to create two applications without any error.

It looks like it is indeed an issue with typescript because after doing what @cvgaviao suggested I was able to create new applications so I am closing this issue.

I got nxCannot read property 'getBuilderConfiguration' of undefined when trying to serve an app after generating workspace. Turns out I forgot to generate an app after generating workspace...

Was this page helpful?
0 / 5 - 0 ratings