Difficulty updating minimist with Angular 9

Viewed 1506

I've been doing an Angular 9 project for some time now. A while back, a warning popped up about a moderate security vulnarability with the minimist package. However, when I try to fix them with (sudo) npm audit fix, it can't fix these issues, and (sudo) npm update won't update them either, even though they have newer versions. How can I fix this?

You can reproduce this problem with a brand new Angular 9 application; minimist is installed by default. For a new project, they will show up as a 'low' level vulnerability, but I think the gist of it is the same.

2 Answers

This is great question. I do this to fix the vulnerability issue.

Add this in package.json like last entry after devDependencies;

"resolutions": {
        "minimist": "^1.2.5"
 }

and in scripts section add:

  "scripts": {
    "preinstall": "npx npm-force-resolutions"`
  }

when you finish run this in your terminal:

npx npm-force-resolutions && npm install

But when installing a new package it usually go back to the previous version and I run the previous command again.

Related