ngneat / svg-icon

👻 A lightweight library that makes it easier to use SVG icons in your Angular Application
https://netbasal.com
MIT License
257 stars 35 forks source link

An unhandled exception occurred: Cannot find module 'bluebird' #56

Closed elliottregan closed 2 years ago

elliottregan commented 2 years ago

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

Running the command npx ng add @ngneat/svg-icon fails to install svg-icon, and throws the following error


The package @ngneat/svg-icon@3.2.0 will be installed and executed.
Would you like to proceed? Yes
✔ Package successfully installed.
An unhandled exception occurred: Cannot find module 'bluebird'
Require stack:
- /node_modules/@schematics/update/node_modules/pacote/extract.js
- /node_modules/@schematics/update/node_modules/pacote/index.js
- /node_modules/@schematics/update/update/npm.js
- /node_modules/schematics-utilities/dist/package_update/npm.js
- /node_modules/schematics-utilities/dist/package_update/index.js
- /node_modules/schematics-utilities/dist/index.js
- /node_modules/@ngneat/svg-icon/schematics/src/ng-add/index.js
- /node_modules/@angular-devkit/schematics/tools/export-ref.js
- /node_modules/@angular-devkit/schematics/tools/index.js
- /node_modules/@angular/cli/utilities/json-schema.js
- /node_modules/@angular/cli/models/command-runner.js
- /node_modules/@angular/cli/lib/cli/index.js
-/node_modules/@angular/cli/lib/init.js
- /node_modules/@angular/cli/bin/ng
See "/private/var/folders/m2/0bn_68yn0m327y4qw9ggj5c80000gp/T/ng-0gUstZ/angular-errors.log" for further details.

Expected behavior

The command should install this package.

Minimal reproduction of the problem with instructions

  1. npx ng g application test-app
  2. npx ng add @ngneat/svg-icon

Installing the bluebird package globally will make this command work again.

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

This command should work.

Environment


Angular version: X.Y.Z


For Tooling issues:
- Node version: 16
- Platform:  Mac

Others:

NetanelBasal commented 2 years ago

https://github.com/angular/angular-cli/issues/20685

NetanelBasal commented 2 years ago

I would be happy to remove schematics and make a simple node script instead. Do you want to do it?

elliottregan commented 2 years ago

I should be able to take a look.

After reading through the threads, it looks like the issue comes form the schematics-utilities package, Some of its functionality can be replaced with @angular/cdk. Any functionality from schematics-utilities that can't be replaced by @angular/cdk might need to be done from scratch.

Does that approach sound right to you?

NetanelBasal commented 2 years ago

That's what I meant. I would be happy to remove schematics and make a simple node script instead. I don't think we need to use anything from schematics.