npm audit
패키지·런타임
쓰는 꼴
npm audit [fix] [--audit-level=<level>]설치된 의존성에 알려진 취약점이 있는지 알려 줍니다 — fix --force는 호환이 깨지는 상위 버전까지 올리고, 개발용 깊은 의존성 경고는 손쓸 수 없는 경우가 많습니다.
자주 쓰는 옵션
| 옵션 | 뜻 |
|---|---|
| fix | upgrade what it can inside your version ranges |
| fix --force | allow breaking major upgrades to clear a report |
| --audit-level=high | only fail on high and above |
| --omit=dev | ignore dev-only dependencies |
| --json | machine-readable report |
| --dry-run | show the plan without changing anything |
예시
npm auditlists known vulnerabilities in the installed tree
npm audit fixupgrades the ones that fit your ranges
npm audit fix --forcemay install major versions that break your build
무엇을 어디에 넣는지가 문제입니다. 프로젝트 안인지 시스템 전체인지 먼저 정하세요.
읽는 방법
- 대괄호 [ ]는 넣어도 되고 안 넣어도 되는 자리입니다.
- 점 셋 …은 여러 개를 이어 쓸 수 있다는 뜻입니다.
- 옵션은 대소문자를 가립니다 — -r과 -R이 다른 명령도 있습니다.
자주 묻는 것
Q. npm audit은 무엇을 하나요?
설치된 의존성에 알려진 취약점이 있는지 알려 줍니다 — fix --force는 호환이 깨지는 상위 버전까지 올리고, 개발용 깊은 의존성 경고는 손쓸 수 없는 경우가 많습니다.
Q. 어떻게 치나요?
npm audit [fix] [--audit-level=<level>] — 대괄호는 생략할 수 있는 자리입니다.
Q. 옵션은 몇 개나 자주 쓰나요?
여기 정리한 것은 6개입니다. 전체 목록은 man npm에 있습니다. 이 명령은 패키지·런타임 갈래입니다.
같이 보는 명령
man 페이지: man npm-audit