I am following a TypeScript tutorial.
Unfortunately, the packages are outdated and I got a warning about vulnerabilities.
I followed a bunch of suggestions from npm check and update package if needed, namely:
npm audit fixnpm audit fix --forcenpm update
npm audit says there are still 24 vulnerabilities left.
But none of the above commands will fix them.
npm outdated results in no output.
The vulnerable packages are :
ansi-regex
glob-parent
node-forge
nth-check
postcss
I don't actually know why they are part of my project.
I don't have them in my package.json.
What are the next steps for fixing these vulnerabilities?
Below is what I have tried.
- How to fix npm vulnerabilities? which has no answers.
- Manually updating the dependencies in
package.jsonto newer versions and then runningnpm install. It didn't have an effect. - Deleting
package-lock.jsonas suggested here and then runningnpm installagain. - Adding
"ansi-regex": "^6.0.1", "glob-parent": "^6.0.2", "node-forge": "^1.3.0", "nth-check": "^2.0.1", "postcss": "^8.4.12"as devDependencies and runningnpm install. - Running
npm i npm@latestas suggested in How to fix npm vulnerabilities. - How to fix npm vulnerabilities? I tried two methods, problems persist
which didn't have any new suggestions. - I have 5 moderate severity vulnerabilities when I checked the npm audit
which also didn't suggest any new commands. - Running
npm update glob-parent --depth 2just to find out that--depthis deprecated and that npm always updates any depth [GitHub]. - Running
npm prune. - Deleting the
node_modulesfolder and runningnpm installagain.
You can reproduce my latest state with the following package.json in an empty directory and running npm install.
{
"name": "pacman",
"version": "0.0.1",
"description": "I just follow a tutorial. Nothing of interest.",
"keywords": ["game"],
"license": "MIT",
"author": "someone stupid",
"scripts": {
"build": "parcel build index.html",
"dev": "parcel index.html --open",
"start": "npm run build && npm run dev",
"test": "echo \"Error: no test specified\" && exit 1"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.16.0",
"@typescript-eslint/parser": "^5.16.0",
"ansi-regex": "^6.0.1",
"eslint": "^8.12.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.0.0",
"glob-parent": "^6.0.2",
"node-forge": "^1.3.0",
"nth-check": "^2.0.1",
"parcel": "^2.4.0",
"parcel-bundler": "^1.12.5",
"postcss": "^8.4.12",
"prettier": "^2.6.1",
"typescript": "^4.6.3"
},
"dependencies": {
"npm": "^8.5.5"
}
}
This should give you 24 vulnerabilities, 18 moderate and 6 high, at the time of writing, running npm version 8.5.5.



npm auditrecreates (maybe one of) the warnings on a vulnerable dependency. If you're just running through a tutorial, though (or they're e.g. development deps), do the warnings even matter?npm init -y && npm i parcel-bundler@1->24 vulnerabilities (19 moderate, 5 high). Or e.g.npm ls node-forgeon what you posted, as suggested above, would show that despite the direct dependency on1.3.0, you have a transitive dependency on0.10.0viaparcel-bundler.