node ) Sharp 모듈 에러 날때
안녕하세요! 비버팩토리입니다. 이미지 리사이징 주제로 포스팅 글 올립니다.
sharp 모듈 설치시 주의 사항이라고 참고 자료를 확인해서 해결 하려고 했는데 해결 되지 않는다
가상서버로 실행중이라서.. 아무리 해도 문제 해결 되지 않는다.
npm install --platform=linux sharp
그래서 Sharp 모듈에서 깃헙 이슈를 찾다가 발견 했다.
https://github.com/lovell/sharp/issues/4001
Error: Could not load the "sharp" module using the linux-x64 runtime on AWS Lambda · Issue #4001 · lovell/sharp
Possible bug Is this a possible bug in a feature of sharp, unrelated to installation? Running npm install sharp completes without error. Running node -e "require('sharp')" completes without error. ...
github.com
여기서 맨 마지막 줄에 보면 버전을 낮추라는 말이 있는데 0.33.4 => 0.33.2로 하라고 했는데 이문제는 아닌것 같고 제일 마지막 명령어로 하니까 해당 에러는 바로 풀린다.
trippingcats의 댓글을 답합니다 3주 전
npm install @img/sharp-darwin-arm64 @img/sharp-libvips-darwin-arm64 @img/sharp-libvips-linux-x64 @img/sharp-libvips-linuxmusl-x64 @img/sharp-linux-x64 @img/sharp-linuxmusl-x64 --force
복붙하고 실행 했더니 바로 해결!!
참고 자료 :
[NODE] 📚 Sharp 모듈 사용법 - 이미지 리사이징 / 워터마크 넣기
Sharp 모듈 노드 진영에는 많은 이미지 리사이징 패키지들이 있었지만, 끝까지 살아남은 모듈이 shap 이다. 이미지 리사이징 동작 자체가 cpu와 메모리를 잡아먹는 주범이라, 가끔 out of memory로 node
inpa.tistory.com