Nx: `ng generate ngrx`: Cannot read property 'split' of undefined

Created on 11 Oct 2017  路  5Comments  路  Source: nrwl/nx

$ ng g ngrx
Cannot read property 'split' of undefined
TypeError: Cannot read property 'split' of undefined
    at Class.run (~\node_modules\@angular\cli\commands\generate.js:112:63)
    at resolve (~\node_modules\@angular\cli\ember-cli\lib\models\command.js:261:20)
    at Promise (<anonymous>)
    at Class.validateAndRun (~\node_modules\@angular\cli\ember-cli\lib\models\command.js:2
40:12)
    at Promise.resolve.then.then (~\node_modules\@angular\cli\ember-cli\lib\cli\cli.js:140
:24)
    at <anonymous>

Expected better error message / help.

bug

Most helpful comment

The ng g ngrx command requires a <name> value and the --module option.

ng g ngrx stateModelName --module=pathToModuleToAddItTo

I think the Angular CLI used to display error messages reporting when required generator options were not used. Maybe this changed. We need to take a look at that and see if that is a fix needed for the Angular CLI or if it is something we should add to the Nx schematic for ngrx.

All 5 comments

could you provide a repro?

Hi Viktor @vsavkin,

here is the repository: https://github.com/dherges/nx-sandbox

It has been set up with the sandbox script (see above) on a Windows 7 64bit machine.

I do have the exact same problem on Ubuntu 17.04 64 bit so it doesn't seem to be related to Windows

The ng g ngrx command requires a <name> value and the --module option.

ng g ngrx stateModelName --module=pathToModuleToAddItTo

I think the Angular CLI used to display error messages reporting when required generator options were not used. Maybe this changed. We need to take a look at that and see if that is a fix needed for the Angular CLI or if it is something we should add to the Nx schematic for ngrx.

The module param is marked as "required", so must be an issue with AngularCLI. I added a test to verify that: https://github.com/nrwl/nx/commit/d16db1a311512e6a4454bd193228cedc25ed3143

Closing this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

about-code picture about-code  路  3Comments

MichaelWarneke picture MichaelWarneke  路  3Comments

markphip picture markphip  路  3Comments

zachnewburgh picture zachnewburgh  路  3Comments

danieldanielecki picture danieldanielecki  路  3Comments