2

Hello wonderful stackoverflow community! I've recently started adventuring into Angular and I come seeking help.

In a nutshell, I have a project which was using the library ng-otp-input. I made my own fork of it to introduce a new feature and now I want to incorporate it to my project. The fork is: MauDagos/ng-otp-input.

I didn't want to publish my fork to npm, since I'd rather it got merged into the original library (a pull request is open at the moment), but I want to incorporate to it my project in the meanwhile. I searched around and found that the easiest approach is to just install the library from github, like so: $ npm install --save https://github.com/MauDagos/ng-otp-input.

The above works and my project's package.json file is updated to include "ng-otp-input": "git+https://github.com/MauDagos/ng-otp-input.git". This all looks correct, and I can verify by going into node-modules/ that my fork was indeed installed. However, when starting the project I get:

src/app/app.module.ts:8:34 - error TS2307: Cannot find module 'ng-otp-input' or its corresponding type declarations.

8 import { NgOtpInputModule } from 'ng-otp-input';
                                   ~~~~~~~~~~~~~~

I've tried running npm install and also lots and lots of other solutions I could find in the web for similar issues, but none has worked.

Thanks in advance to everyone!

Edit: I've tried adding "prepare": "npm run build" to the library's package.json, in a separate branch, then doing npm install from that branch like $ npm install --save github:<github-user>/<github-repo-name>#<branch>, but no luck. Idea taken from here.

1 Answers1

0

It seems like you haven't actually build the module. For those stuck at the same issue -

  • Navigate to the installed packages within the node_modules folder and build the package using yarn build or whatever command you might have set.

  • That's it!

Aryan Shridhar
  • 176
  • 3
  • 7