-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
ng generate commands no longer work after installing @ngrx/schematics #3760
Comments
I'm seeing the same error whenever I try to generate an NGRX object (i.e. reducer) |
I also tried to reproduce this but I couldn't reproduce this (maybe because it's using NgRx v15.2.1 but we didn't touch the schematics package). I ended up with the following packages: "dependencies": {
"@angular/animations": "^15.1.0",
"@angular/common": "^15.1.0",
"@angular/compiler": "^15.1.0",
"@angular/core": "^15.1.0",
"@angular/forms": "^15.1.0",
"@angular/platform-browser": "^15.1.0",
"@angular/platform-browser-dynamic": "^15.1.0",
"@angular/router": "^15.1.0",
"rxjs": "~7.8.0",
"tslib": "^2.3.0",
"zone.js": "~0.12.0"
},
"devDependencies": {
"@angular-devkit/build-angular": "^15.1.3",
"@angular/cli": "~15.1.3",
"@angular/compiler-cli": "^15.1.0",
"@ngrx/schematics": "^15.2.1",
"@types/jasmine": "~4.3.0",
"jasmine-core": "~4.5.0",
"karma": "~6.4.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.2.0",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.0.0",
"typescript": "~4.9.4"
} |
I performed the update for NGRX and the CLI using the instructions here. This succeeded, but left me with the original error. Whenever I try to generate and NGRX object, I get the following:
Note: I did not use the --defaultCollection flag I haven't tried creating any Angular objects, but assume I'll have the same issue. Here are my dependencies/versions (specific to NGRX and Angular): Dependencies
Dev Dependencies
|
@millerbill3 that's also working in my case. |
I ran
|
Do you perhaps got a repo that you can share? |
Try |
Hi guys, do you try this?: "cli": {
"schematicCollections": ["@schematics/angular", "@ngrx/schematics"],
"analytics": false
}, just add "@schematics/angular" to "schematicCollections" |
@sunanan your solution worked for me. thanks! |
Feel free to reopen with a reproduction. |
I believe my issue was due to package versions being off. I updated to the latest angular/cli, created a fresh project, and went through the process of |
Which @ngrx/* package(s) are the source of the bug?
schematics
Minimal reproduction of the bug/regression with instructions
Installing
@ngrx/schematics
breaksng generate *
. I am following the documentation trying to install ngrx schematics and it doesn't appear to be working. The first red flag is that the documentation states that runningng add @ngrx/schematics
automates the addition of configuring your angular.json as such:However, this is not true. Instead of
cli.defaultCollection
, we getcli.schematicCollections
.If you were to change
schematicCollections
todefaultCollection
, it works. Additionally, running theng add
command with the--defaultCollection
flag has no impact.Looking into what
schematicsCollections
is vs what is stated in the ngrx docs (defaultCollection
) leads me to issue #3383. Maybe the documentation didn't get updated after this fix and it's causing confusion?In any case, I am not sure if this is specific to angular version 15.1.1 or something else. But, if you follow the below reproduction steps, you can see that
ng generate *
is broken after you install@ngrx/schematics
.Here is the package.json from the fresh project:
Minimal reproduction of the bug/regression with instructions
ng generate component something
)ng add @ngrx/schematics
)ng generate component something
)You are met with an error
Versions of NgRx, Angular, Node, affected browser(s) and operating system(s)
NgRx: 15.1.0 (is there a 15.1.1 on the horizon? assuming this should match the angular version...)
Angular: 15.1.1
Node: 18.13.0
Mac: Ventura 13.1
Other information
No response
I would be willing to submit a PR to fix this issue
The text was updated successfully, but these errors were encountered: