akita: schematics-utilities doesn't compatible with ng12

I’m submitting a…


[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:

Current behavior

Following the instructions in the documentation: https://datorama.github.io/akita/docs/angular/architecture but it crashes.

Expected behavior

It doesn’t crash.

Minimal reproduction of the problem with instructions

  1. npx @angular/cli new e-commerce
  2. ng add @datorama/akita

This is the output:

ng add @datorama/akita
ℹ Using package manager: npm
✔ Found compatible package version: @datorama/akita@6.2.1.
✔ Package information loaded.

The package @datorama/akita@6.2.1 will be installed and executed.
Would you like to proceed? Yes
✔ Package successfully installed.
An unhandled exception occurred: Cannot find module 'bluebird'
Require stack:
- C:\Temp\e-commerce\node_modules\@schematics\update\node_modules\pacote\extract.js
- C:\Temp\e-commerce\node_modules\@schematics\update\node_modules\pacote\index.js
- C:\Temp\e-commerce\node_modules\@schematics\update\update\npm.js
- C:\Temp\e-commerce\node_modules\schematics-utilities\dist\package_update\npm.js
- C:\Temp\e-commerce\node_modules\schematics-utilities\dist\package_update\index.js
- C:\Temp\e-commerce\node_modules\schematics-utilities\dist\index.js
- C:\Temp\e-commerce\node_modules\@datorama\akita\schematics\ng-add\index.js
- C:\Temp\e-commerce\node_modules\@angular-devkit\schematics\tools\export-ref.js
- C:\Temp\e-commerce\node_modules\@angular-devkit\schematics\tools\index.js
- C:\Temp\e-commerce\node_modules\@angular\cli\utilities\json-schema.js
- C:\Temp\e-commerce\node_modules\@angular\cli\models\command-runner.js
- C:\Temp\e-commerce\node_modules\@angular\cli\lib\cli\index.js
- C:\Users\m.ghaoui\AppData\Roaming\npm\node_modules\@angular\cli\lib\init.js
- C:\Users\m.ghaoui\AppData\Roaming\npm\node_modules\@angular\cli\bin\ng
See "C:\Users\M182C~1.GHA\AppData\Local\Temp\ng-pkKJez\angular-errors.log" for further details.

What is the motivation / use case for changing the behavior?

Evaluating Akita for my next project

Environment


Angular version: X.Y.Z


Angular CLI: 12.1.4
Node: 14.17.3
Package Manager: npm 6.14.13
OS: win32 x64

Angular: 12.1.4
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1201.4
@angular-devkit/build-angular   12.1.4
@angular-devkit/core            12.1.4
@angular-devkit/schematics      12.1.4
@schematics/angular             12.1.4
rxjs                            6.6.7
typescript                      4.3.5

Browser:
N/A
 
For Tooling issues:
- Node version: 14.17.3
- Platform:  Windows

Others:

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 31 (8 by maintainers)

Most upvoted comments

Not sure if deleting the cache works, but I figured out a workaround for anyone interested.

Angular version: 12.2.2 Akita version: 6.2.3

Before using the schematic, first install Akita with npm: npm i @datorama/akita The schematic will work fine after that: ng add @datorama/akita

Good luck!

Angular 12 came out 3 months ago, and the betas probably long before that. The fact that it Akita doesn’t work and the fact that I’m the first one to report it tells me that you’re not keeping up with the latest Angular releases.

I’m only left to conclude that either this project is dead or your attention is elsewhere. One thing is for sure, I don’t think it’s being used much.

I’m going to be moving on.

For me was helpful to remove from angular.json next lines:

  "cli": {
    "defaultCollection": "@datorama/akita"
  },

OK, I have worked this out. I did it by actually reading what @NetanelBasal said (possibly elsewhere) about how the schematics are now built in to @datorama/akita now and akita-schematics was deprecated.

I was using this command:

nx g akita-schematics:feature feature-name --project=whatever

and I should have been using this:

nx g @datorama/akita:feature feature-name --project=whatever

I couldn’t use the abbreviated af schematic name because I already have another default builder in place for my Tailwind/PostCSS stuff and I’m NOT messing with that. 😄

THANK YOU.

Akita was still a wonderful gift anyway, but this makes my life easier again to have solved this.

I still have this problem (with v6.2.3):

❯ npx @angular/cli new e-commerce
❯ cd e-commerce
❯ ng add @datorama/akita
ℹ Using package manager: npm
✔ Found compatible package version: @datorama/akita@6.2.3.
✔ Package information loaded.
 
The package @datorama/akita@6.2.3 will be installed and executed.
Would you like to proceed? Yes
✔ Package successfully installed.
An unhandled exception occurred: Cannot find module 'bluebird'
Require stack:
- /Users/xxx/dev/angular/e-commerce/node_modules/@schematics/update/node_modules/pacote/extract.js
- /Users/xxx/dev/angular/e-commerce/node_modules/@schematics/update/node_modules/pacote/index.js
- /Users/xxx/dev/angular/e-commerce/node_modules/@schematics/update/update/npm.js
- /Users/xxx/dev/angular/e-commerce/node_modules/schematics-utilities/dist/package_update/npm.js
- /Users/xxx/dev/angular/e-commerce/node_modules/schematics-utilities/dist/package_update/index.js
- /Users/xxx/dev/angular/e-commerce/node_modules/schematics-utilities/dist/index.js
- /Users/xxx/dev/angular/e-commerce/node_modules/@datorama/akita/schematics/ng-add/index.js
- /Users/xxx/dev/angular/e-commerce/node_modules/@angular-devkit/schematics/tools/export-ref.js
- /Users/xxx/dev/angular/e-commerce/node_modules/@angular-devkit/schematics/tools/index.js
- /Users/xxx/dev/angular/e-commerce/node_modules/@angular/cli/utilities/json-schema.js
- /Users/xxx/dev/angular/e-commerce/node_modules/@angular/cli/models/command-runner.js
- /Users/xxx/dev/angular/e-commerce/node_modules/@angular/cli/lib/cli/index.js
- /Users/xxx/.nvm/versions/node/v14.15.4/lib/node_modules/@angular/cli/lib/init.js
- /Users/xxx/.nvm/versions/node/v14.15.4/lib/node_modules/@angular/cli/bin/ng
See "/private/var/folders/bc/_gxct1jj67q0qt1_16glzff00000gp/T/ng-4f6M7Z/angular-errors.log" for further details.

Also, this looks not good

image

And according to this comment https://github.com/angular/angular-cli/issues/20685#issuecomment-831767467 may not be fixed soon.

Maybe instead of schematics-utilities we can try something more lightweight like 🤔 https://github.com/TinkoffCreditSystems/ng-morph

@NetanelBasal This is exactly what does not work for me:

akita

Any information or logs we can provide?

Fixed in v6.2.3