한동안 건드리지 않았던 front-end 코드를 건드릴 일이 생겨, node를 깔았는 데, npm 을 실행할 때마다 다음과 같은 warning 메시지가 출력됩니다.
> npm -v
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
8.11.0
명령을 실행할 때마다, 경고 메시지가 뜨는게 불편해서 찾아보니 저 말고도 불편함을 느끼는 사람이 좀 있었습니다. 아래 링크에서 해결책을 찾을 수 있었습니다.
https://github.com/npm/cli/issues/4980
[BUG] `npm.cmd` uses deprecated switch `-g` · Issue #4980 · npm/cli
Is there an existing issue for this? I have searched the existing issues This issue exists in the latest npm version I am using the latest npm Current Behavior When invoking npm --version on Window...
github.com
해결책은 npm의 버전을 8.12.1 이상으로 업그레이드 하는 것입니다. (현재 nodejs(v16.16)의 윈도우즈 설치버전을 통해서 설치되는 npm 버전이 8.11 인데 거기서 문제가 발생하여 8.12.1에서 다시 원복하였다고 합니다. https://github.com/npm/cli/issues/4980#issuecomment-1145164050 )
npm의 업그레이드는 파워쉘을 통해서 할 수 있고, 관리자 모드로 실행해야 합니다.
> Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process
> npm install -g npm-windows-upgrade
> npm-windows-upgrade
마지막 명령을 실행하고 나면 npm을 업그레이드하고, 이후 부터 경고 메시지는 더 이상 나타나지 않습니다.

- 추가
오늘 다른 PC에도 동일한 현상이 있었는데, 여기서는 npm 버전이 8.16.0으로 되어 있었는데 warning 메시지가 발생했습니다. 다만 다른 점은 'npm-windows-upgrade' 대신 'npm install -g npm@8.16.0' 으로 새로운 버전을 설치했다는 것입니다. 깃헙에서 얘기한 버전 문제가 아닌 다른 문제가 원인이 아닐까 생각됩니다.