본문 바로가기
error | tip/error

read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!

by meno1011 2022. 10. 26.
728x90

다른 노트북에서 프로젝트를 진행하고 파일을 집으로 가져와서 npm install 을 했는데 발생한 에러다..!

npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!
npm ERR! Maximum call stack size exceeded
npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\User\AppData\Roaming\npm-cache\_logs\2022-10-25T13_12_02_469Z-debug.log

이렇게 터미널에 뜨는것이다.. ㄷㄷ 

이건 프로젝트를 생성한 환경과 옮겨온 환경이 달라서 발생하는 에러였다. (npm 버전이 달라서 )

그래서 해결 방법으로

npm install --global npm 를 하여 npm을 최신 버전으로 변경해주었다.

후에 다시 npm install을 해봤더니

PS C:\Users\User\Desktop\next-sap> npm install --global npm
npm ERR! code EEXIST
npm ERR! path C:\Users\User\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js
npm ERR! dest C:\Users\User\AppData\Roaming\npm\npm
npm ERR! EEXIST: file already exists, cmd shim 'C:\Users\User\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js' -> 'C:\Users\User\AppData\Roaming\npm\npm'
npm ERR! File exists: C:\Users\User\AppData\Roaming\npm\npm
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.

음.. 에러라 난리 치는데 node_modules 폴더도 생성되었구 npm start도 실행되었다 아마 npm버전이 올라가면서 발생한 오류이지 않을까 싶은데 에러를 보면 지우고 다시하라고 해서 npm install을 다시하면 괜찮을 것으로 생각된다.