Skip to content

Instantly share code, notes, and snippets.

@gloriousLoaf
Last active March 30, 2021 17:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gloriousLoaf/5019c7e028a44d9b15f60084a6b5813e to your computer and use it in GitHub Desktop.
Save gloriousLoaf/5019c7e028a44d9b15f60084a6b5813e to your computer and use it in GitHub Desktop.
Resolving Node Package Security Issues

Resolving Node Package Security Issues

This is an excerpt from a post I wrote on DEV

Using npm-force-resolutions is a last resort!
Please read their docs and my post above for more details.

/* 1. lean on npm to fix issues */
npm audit fix

/* 2. re-audit to find stubborn issues */
npm audit

/* 3. if using the latest packages is fine, update your top-level dependencies    */
npm update

/* 4. if all else fails, force resolutions by adding this to package.json and doing another install */
{
  "scripts": {
    "preinstall": "npx npm-force-resolutions",
  },
  "resolutions": {
    "bad-pack-1": "1.5.0"
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment