오랫동안 사용하지 않은 창고의 취약성 보고서 때문에 npm 패키지를 업데이트해 시원하게

오랜만에 npm 사용 항목npm i을 열면 경고를 받는다.
% npm i
audited 1292 packages in 5.692s

113 packages are looking for funding
  run `npm fund` for details

found 2 high severity vulnerabilities
  run `npm audit fix` to fix them, or `npm audit` for details
번역vulnerabilities이 바로'취약성'이다.야단났네.npm audit 명령을 사용하면 취약성에 문제가 있는 매크로 패키지를 보여 줍니다.
% npm audit

=== npm audit security report ===

... (中略)

found 25 vulnerabilities (2 low, 23 high) in 1293 scanned packages
  run `npm audit fix` to fix 23 of them.
  2 vulnerabilities require manual review. See the full report for details.
많은 풀을 발견했다
근데 GiitHub한테 엄청 혼났어요.
NG

업데이트


npm-check-updates 이 공구는 매우 편리하기 때문에 이것을 사용합니다.
% npm i -g npm-check-updates
ncu명령을 사용할 수 있기 때문에 쳐야 합니다.
% ncu
Checking /Users/feb19/git/web/nuxt-content-web/package.json
[====================] 2/2 100%

 @nuxt/content   ^1.0.0  →   ^1.11.1     
 nuxt           ^2.12.2  →  ^2.14.12     

Run ncu -u to upgrade package.json
ncu -u면 되잖아?야단을 맞다.
% ncu -u
Upgrading /Users/takahashi.nobuhiro/git/web/nuxt-content-web/package.json
[====================] 2/2 100%

 @nuxt/content   ^1.0.0  →   ^1.11.1     
 nuxt           ^2.12.2  →  ^2.14.12     

Run npm install to install new versions.
나는 이 녀석과 이 녀석이 나쁘다는 것을 안다.
이 시기에 개작할 수 있다package.json.
  "dependencies": {
-    "@nuxt/content": "^1.0.0",
-    "nuxt": "^2.12.2"
+    "@nuxt/content": "^1.11.1",
+    "nuxt": "^2.14.12"
   }
 }
npm install면 되잖아?야단을 맞다.
% npm i
...(中略

added 245 packages from 316 contributors, removed 129 packages, updated 304 packages, moved 14 packages and audited 1408 packages in 34.762s

100 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
이 시간 패키지의 업데이트 운행은 package-lock.json도 바꿀 수 있다.
나는 또 한 번 시도했다npm audit.
% npm audit
                                                                                
                       === npm audit security report ===                        
                                                                                
found 0 vulnerabilities
 in 1408 scanned packages
너무 좋아요.
그래서commiit
https://github.com/feb19/nuxt-content-web/commit/771b7b59da41149ea229f0d1b36f8e3489cbe2cc
GiitHub씨도 안심하셨어요.
OK

주의점


주요 버전에 업로드되기 때문에 브레이크 체인지가 있어 업데이트 후 오류가 발생할 수 있습니다.
유닛 테스트, E2E 테스트, 팀 평가, CI 등을 진행하고 시스템을 안정적으로 업데이트하기 위해 사전에 대책을 세우는 것이 좋다.(지나치지 않도록 주의한다)
자동ncu -u CI인 경우 주의하십시오.

기타


  • npm-check 이런 도구가 있으니 이걸 좋아하시는 분들은 선택하세요.
  • npm i를 진행하다가 욕을 먹기 전npm outdated도 명령을 통해 오래된 물건을 볼 수 있다
  • % npm outdated
    Package        Current   Wanted   Latest  Location
    @nuxt/content    1.2.0   1.11.1   1.11.1  nuxt-content-web
    nuxt            2.12.2  2.14.12  2.14.12  nuxt-content-web
    
  • npm audit fix 명령으로 수정할 수도 있지만 패치를 받지 못해 자동으로 수정하지 못하는 경우도 있어 수정할 수 없을 수 있다.
  • % npm audit fix
    removed 1 package and updated 4 packages in 4.848s
    
    113 packages are looking for funding
      run `npm fund` for details
    
    fixed 23 of 25 vulnerabilities in 1293 scanned packages
      2 vulnerabilities required manual review and could not be updated
    
    % npm audit
                                                                                    
                           === npm audit security report ===                        
                                                                                    
    ... (中略)
    
    found 2 high severity vulnerabilities in 1292 scanned packages
      run `npm audit fix` to fix 2 of them.
    
    そして無限へ...
    

    감광

  • 참고할 수 있지만 이 기사를 통째로 믿지 않기를 바랍니다
  • ncu가 세 글자의 어떤 명령과 겹치는 것 같아요.
  • 왜 내 머릿속의 m.c.A.T가 이리저리 흔들리는지
  • 좋은 웹페이지 즐겨찾기