akita icon indicating copy to clipboard operation
akita copied to clipboard

Cannot find module 'bluebird'

Open Teebo opened this issue 3 years ago • 19 comments

Is this a regression?

Yes

Description

After running ng add @datorama/akita

I get the below output.

The package @datorama/[email protected] 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:\Users\...\Development\appp\node_modules\@schematics\update\node_modules\pacote\extract.js
- C:\Users\...\Development\appp\node_modules\@schematics\update\node_modules\pacote\index.js  
- C:\Users\...\Development\appp\node_modules\@schematics\update\update\npm.js
- C:\Users\...\Development\appp\node_modules\schematics-utilities\dist\package_update\npm.js  
- C:\Users\...Development\appp\node_modules\schematics-utilities\dist\package_update\index.js
- C:\Users\...\Development\appp\node_modules\schematics-utilities\dist\index.js
- C:\Users\...\Development\appp\node_modules\@datorama\akita\schematics\ng-add\index.js      
- C:\Users\...Development\appp\node_modules\@angular-devkit\schematics\tools\export-ref.js  
- C:\Users\...\Development\appp\node_modules\@angular-devkit\schematics\tools\index.js
- C:\Users\...\Development\appp\node_modules\@angular\cli\utilities\json-schema.js
- C:\Users\...\Development\appp\node_modules\@angular\cli\models\command-runner.js
- C:\Users\...\Development\appp\node_modules\@angular\cli\lib\cli\index.js
- C:\Users\...\AppData\Roaming\npm\node_modules\@angular\cli\lib\init.js

And I cannot run any Akita schematics

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

No response

Please provide the environment you discovered this bug in

No response

Anything else?

No response

Do you want to create a pull request?

No

Teebo avatar Nov 29 '21 06:11 Teebo

image

NetanelBasal avatar Nov 29 '21 06:11 NetanelBasal

OK I see, but do you have bluebird installed?

Teebo avatar Nov 29 '21 07:11 Teebo

I created a new Angular project.

NetanelBasal avatar Nov 29 '21 07:11 NetanelBasal

OK, let me see what's wrong on my side, I will update and close the issue if it's something on my end

Teebo avatar Nov 29 '21 07:11 Teebo

I have installed bluebird: npm i bluebird and run ng add @datorama/akita. It worked, I have uninstalled bluebird after that, I am not sure what's the issue as the error was also thrown in a new ng project.

Teebo avatar Nov 29 '21 07:11 Teebo

happend to me too, running ng add ... again (without installing bluebird) and its work

Amit775 avatar Dec 04 '21 22:12 Amit775

Same error

sawa-ko avatar Dec 16 '21 01:12 sawa-ko

Also getting this error. Created a fresh Angular 13 app with ng new then immediately followed up with ng add @datorama/akita. Get the missing bluebird module error.

keithotto avatar Feb 01 '22 19:02 keithotto

I am also getting the same error when using Angular 13

basit74 avatar Mar 07 '22 14:03 basit74

+1 Same error with Angular 13 using ng add @datorama/akita.

rohit-pathak avatar Mar 08 '22 06:03 rohit-pathak

bump. Angular 13 using ng add @datorama/akita

sibijohn72 avatar Mar 18 '22 22:03 sibijohn72

Same error, I'm on angular version 13.2.0 and it gives same bluebird error when installed using ng add ...

yousafravian avatar Mar 22 '22 09:03 yousafravian

Screenshot from 2022-03-22 14-44-18 Works after installing bluebird as dependency

yousafravian avatar Mar 22 '22 09:03 yousafravian

@yousafraza39142 why do I need to install bluebird for it to work? What is bluebird for?

Teebo avatar Mar 22 '22 09:03 Teebo

@yousafraza39142 why do I need to install bluebird for it to work? What is bluebird for? Honestly, I'm not sure, I looked up bluebird and it is an implementation of promises for js.

They have used promises in their utils.ts inside ng-add schematics. Maybe it has something to do with it

yousafravian avatar Mar 22 '22 10:03 yousafravian

I tried installing bluebird and then re-installing akita, then i get
image

does anyone know if there's a patch for this

Randle-Lanre avatar Mar 27 '22 19:03 Randle-Lanre

+1 Same error using ng add on Angular 13

jerosancho avatar Apr 26 '22 10:04 jerosancho

@jerosancho use npm to remove Akita,

ensure all imports/declarations related to Akita are removed from your app.module.ts

then proceed to add the bluebird package and then akita.

this was the fix for my own issue

Randle-Lanre avatar Apr 26 '22 11:04 Randle-Lanre

it looks like the issue comes from schematics-utilities having dependencies on angular 8 https://github.com/nitayneeman/schematics-utilities/blob/master/package.json#L37-L44

another schematic had this exact same issue, and they ended up removing schematics-utilities in favor of angular/cdk https://github.com/angular/angular-cli/issues/20685 https://github.com/oktadev/schematics/pull/569

for now however, you should just be able to install bluebird, run the schematics and then uninstall it another way would be to just bypass the schematics and manually install akita using npm i @datorama/akita and executing ng config cli.defaultCollection @datorama/akita if you want to get the ng g commands for akita (note that with angular 14, you will be able to have multiple values in defaultCollection, which will be usefull if you already have a library giving you custom ng g commands)

AnthonyLenglet avatar May 12 '22 09:05 AnthonyLenglet

The repo is updated now. I'll release new versions soon.

NetanelBasal avatar Jan 09 '23 07:01 NetanelBasal