--legacy-peer-deps vs --force when npm install

2024. 5. 28. 16:18Backup

https://stackoverflow.com/questions/66020820/npm-when-to-use-force-and-legacy-peer-deps

 

npm: When to use `--force` and `--legacy-peer-deps`

I'm trying to understand how recreating the node_modules directory for deployment works. We're using npm ci instead of npm install to ensure a clean slate during deployment. However, when we run it

stackoverflow.com

 

https://github.blog/2021-02-02-npm-7-is-now-generally-available/

 

npm 7 is now generally available!

We’re announcing version 7 of the npm CLI is now generally available.

github.blog

 

--legacy-peer-deps : peerDependency 무시

--force : 더 안전하다... 항상 이상적인 것은 아님. 추가 공간을 차지하기 때문.

( --force를 사용하면 충돌하는 peerDependencies가 루트 프로젝트에 설치되도록 허용)