Platform: [error] ng/schematics - Data path "" should have required property 'name'

Created on 7 May 2018  Â·  17Comments  Â·  Source: ngrx/platform

Everything looks fine but when i run ng generate store State --root --module app.module.ts i get following error:

Schematic input does not validate against the Schema: 
{  
   "dryRun":false,
   "root":true,
   "module":"app.module.ts",
   "path":"app",
   "sourceDir":"src",
   "flat":true,
   "spec":true,
   "statePath":"reducers"
}
Errors:
  Data path "" should have required property 'name'.

As you can see (log above) the path (Schema) is not empty! Whats going wrong here?

ng generate --help

Available schematics:
    action
    class
    component
    container
    directive
    effect
    entity
    enum
    feature
    guard
    interface
    module
    pipe
    reducer
    service
    store

package.json:

{
  "dependencies": {
    "@angular/animations": "6.0.0",
    "@angular/cdk": "6.0.0",
    "@angular/common": "6.0.0",
    "@angular/compiler": "6.0.0",
    "@angular/core": "6.0.0",
    "@angular/flex-layout": "6.0.0-beta.15",
    "@angular/forms": "6.0.0",
    "@angular/http": "6.0.0",
    "@angular/material": "6.0.0",
    "@angular/platform-browser": "6.0.0",
    "@angular/platform-browser-dynamic": "6.0.0",
    "@angular/router": "6.0.0",
    "@ngrx/effects": "5.2.0",
    "@ngrx/entity": "5.2.0",
    "@ngrx/router-store": "5.2.0",
    "@ngrx/store": "5.2.0",
    "core-js": "2.5.5",
    "hammerjs": "2.0.8",
    "normalize.css": "8.0.0",
    "ramda": "0.25.0",
    "run-script-os": "1.0.3",
    "rxjs": "6.1.0",
    "zone.js": "0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "0.6.0",
    "@angular/cli": "6.0.0",
    "@angular/compiler-cli": "6.0.0",
    "@angular/language-service": "6.0.0",
    "@ngrx/schematics": "5.2.0",
    "@ngrx/store-devtools": "5.2.0",
    "@types/jasmine": "2.8.7",
    "@types/jasminewd2": "2.0.3",
    "@types/node": "9.6.2",
    "codelyzer": "4.3.0",
    "jasmine-core": "2.8.0",
    "jasmine-spec-reporter": "4.2.1",
    "karma": "2.0.2",
    "karma-chrome-launcher": "2.2.0",
    "karma-coverage-istanbul-reporter": "1.4.2",
    "karma-firefox-launcher": "1.1.0",
    "karma-jasmine": "1.1.2",
    "karma-jasmine-html-reporter": "0.2.2",
    "karma-opera-launcher": "1.0.0",
    "karma-safari-launcher": "1.0.0",
    "protractor": "5.3.1",
    "rxjs-compat": "6.1.0",
    "should": "13.2.1",
    "ts-node": "5.0.1",
    "tslint": "5.10.0",
    "typescript": "2.7.2"
  }
}

Most helpful comment

just add a command line argument --name, it is a separate property from 'path' and is the name of your feature, effect or action. It is only used when the store is not for a root module tho.

All 17 comments

just add a command line argument --name, it is a separate property from 'path' and is the name of your feature, effect or action. It is only used when the store is not for a root module tho.

@joscmw95 thanks it worked :)

I have to open that issue again because there is something weird!
That commands leads to the same results (see below):

ng generate store State --root --module app.module.ts --name action
ng generate store State --root --module app.module.ts --name effect
ng generate store State --root --module app.module.ts --name abcds
ng generate store State --root --module app.module.ts --name

app.module.ts:

@NgModule({
  ...
  ...
  imports: [
    StoreModule.forRoot(reducers, { metaReducers }),
    !environment.production ? StoreDevtoolsModule.instrument() : [],
  ],
  ...
  ...
})

app/reducers/index.ts:

export interface State {
};

export const reducers: ActionReducerMap<State> = {
};

export const metaReducers: MetaReducer<State>[] = !environment.production ? [] : [];

Or have I misunderstood you?

from 'path' and is the name of your feature, effect or action

It is only used when the store is not for a root module tho.

Only if the store isn't for a root module does the name affect anything, we could probably refactor such that options.name is only required if --root is specified.

we could probably refactor such that options.name is only required if --root is specified

make sense!

This has already been fixed in master and the syntax will remain the same
as before without the --name

On Mon, May 7, 2018, 3:12 PM Bitcollage notifications@github.com wrote:

make sense!

we could probably refactor such that options.name is only required if
--root is specified

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/ngrx/platform/issues/1026#issuecomment-387189504, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AACk48zGtuWpxZoZXzz88JHGfnowo-Mbks5twKqugaJpZM4T1Yvb
.

I was trying to setup NGRX with a fresh angular-CLI generated project, and stumbled upon this issue.

Just to help people that will have the same error : #1045

Even if you get this error in angular try with

ng g module --name module-name
ng g component --name component-name

I removed an old node_module from my C: and ran ng new again it worked just fine

ng g component --name component-name
gives
Invalid rule result: Instance of class Promise.
image

Hi guys, any news about this issue? i'm having the same result as @BuntyBru

C:\xampp\htdocs\apps\og_platform-originplatform (OR-4143 -> origin)
λ ng g c private/components/ad-maker/tab/code-editor-tab/components/editor-modal
Schematic input does not validate against the Schema: {"inlineStyle":false,"inlineTemplate":false,"changeDetection":"Default","styleext":"css","style":"css","spec":true,"skipTests":false,"flat":false,"skipImport":false,"skipSelector":false,"export":false,"entryComponent":false,"lintFix":false}
Errors:

  Data path "" should have required property 'name'.

C:\xampp\htdocs\apps\og_platform-originplatform (OR-4143 -> origin)
λ ng g c private/components/ad-maker/tab/code-editor-tab/components/ --name editor-modal
Invalid rule result: Instance of class Promise.

Any word on this?

Can you provide updated repro steps with the latest release?

I just had the same issue but found that my Global @Angular\CLI had to be updated.
I ran npm install -g @angular/cli.

Then I tried to make a dumpy project just to see if things were working and it gave me this error,
`You are running version v8.9.4 of Node.js, which is not supported by Angular CLI 8.0+.
The official Node.js version that is supported is 10.9 or greater.

Please visit https://nodejs.org/en/ to find instructions on how to update Node.js.`

I updated my nodejs and everything started working for me again.

I had the same errors. Just keep your Angular CLI version in line with node how @zachpappalau said.

How I solved:
npm i --save-dev @angular/cli@latest

ran like a charm. <3

credits: https://stackoverflow.com/a/44526528/8941680

I want to install angular universal inside my project , but I have a problem:

Schematic input does not validate against the Schema: {}
Errors:

Data path "" should have required property 'clientProject'.

@Aurislucero try running ng add @nguniversal/express-engine --client-project=your-project-name . Make sure your project name matches the name in angular.json file ("defaultProject":"nameOfProject"), not package.json.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dmytro-gokun picture dmytro-gokun  Â·  3Comments

gperdomor picture gperdomor  Â·  3Comments

NathanWalker picture NathanWalker  Â·  3Comments

doender picture doender  Â·  3Comments

itprodavets picture itprodavets  Â·  3Comments