Search code examples
angular13signaturepad

Error: Module not found: Error: Can't resolve 'signature_pad' when it's been working for the past 3 weeks


I'm getting this error now after deleting node_modules and doing a fresh npm install

$ ng build
Your global Angular CLI version (14.1.0-next.0) is greater than your local version (13.3.7). The local Angular CLI version is used.

To disable this warning use "ng config -g cli.warnings.versionMismatch false".
- Generating browser application bundles (phase: setup)...
Another process, with id 2112, is currently running ngcc.
Waiting up to 250s for it to finish.
(If you are sure no ngcc process is running then you should delete the lock-file at C:/ClientApp/node_modules/.ngcc_lock_file.)
√ Browser application bundle generation complete.
√ Browser application bundle generation complete.

./node_modules/angular2-signaturepad/fesm2015/angular2-signaturepad.mjs:3:0-52 - Error: Module not found: Error: Can't resolve 'signature_pad' in 'C:\ClientApp\node_modules\angular2-signaturepad\fesm2015'

I'm at a loss. I'm using Angular 13.3.0 and this was working great.

I need to get this fixed. I have scoured the internet for this problem but even though the file is there in node_modules, it can't find it. Node Modules folder showing the file it can't find is actually there!


Solution

  • You probably used "npm i --legacy-peer-deps" to install your packages, which skipped the peer-dependency "signature_pad", and that's why it can't find it.

    As far as I know, you have 2 options:

    1. Use "npm i --force"

    2. Manually include the missing package in your package.json dependencies and use "npm i --legacy-peer-deps"

    To read more about --legacy-peer-deps and --force and their differences: npm: When to use `--force` and `--legacy-peer-deps`